-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-env.sh
executable file
·40 lines (31 loc) · 1.13 KB
/
setup-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -o pipefail
install_dependencies() {
local env_name="$1"
# Create conda environment
mamba create -n $env_name transformers python=3.10 pytorch fairscale dask-mongo torchaudio pytorch-cuda=11.7 iopath cudatoolkit=11.7 -c pytorch -c nvidia -c iopath -c conda-forge -y
eval "$(conda shell.bash hook)"
conda activate $env_name
active_env=$(conda info | awk '/active environment/ {print $NF}')
if [[ $active_env == $env_name ]]; then
# # Install additional conda packages
mamba install rapids=23.02 -c rapidsai -c conda-forge -c nvidia -y
# # Install pip packages
pip install -r server/requirements.txt
echo "Dependencies installed successfully in the $env_name conda environment"
fi
}
enabling_services() {
export userid=$(id -u)
export GID=$(id -g)
docker compose up -d
echo "Docker services are up and running"
}
# Check if environment name is provided as command line argument
if [ $# -ne 1 ]; then
echo "Usage: $0 <environment_name>"
exit 1
fi
# Call the function with provided environment name
install_dependencies "$1"
enabling_services