Byte-lingua-code / setup /create_env.sh
2ira's picture
offline_compression_graph_code
72c0672 verified
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#SBATCH --job-name=env_creation
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --gres=gpu:8
#SBATCH --exclusive
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=128
#SBATCH --mem=0
#SBATCH --time=01:00:00
# Exit immediately if a command exits with a non-zero status
set -e
# Start timer
start_time=$(date +%s)
# Get the current date
current_date=$(date +%y%m%d)
# Create environment name with the current date
env_prefix=lingua_$current_date
# Create the conda environment
python3 -m venv envs/$env_prefix
source envs/$env_prefix/bin/activate
echo "Currently in env $(which python)"
# Install packages
# pip install torch xformers --index-url https://download.pytorch.org/whl/cu121
# pip install ninja
# pip install --requirement requirements.txt
pip install torch
pip install xformers --index-url https://download.pytorch.org/whl/cu124
pip install ninja
pip install --requirement requirements.txt
# End timer
end_time=$(date +%s)
# Calculate elapsed time in seconds
elapsed_time=$((end_time - start_time))
# Convert elapsed time to minutes
elapsed_minutes=$((elapsed_time / 60))
echo "Environment $env_prefix created and all packages installed successfully in $elapsed_minutes minutes!"