-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepare-env.sh
More file actions
executable file
·63 lines (51 loc) · 1.54 KB
/
Copy pathprepare-env.sh
File metadata and controls
executable file
·63 lines (51 loc) · 1.54 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
function prepare_conda_env() {
# the python version to use
local python_version=${1:-3.9}
shift
# the conda env name
local env_name=${1:-mole}
shift
echo ">>> Preparing conda environment \"${env_name}\", python_version=${python_version}"
# Preparation
set -e
eval "$(conda shell.bash hook)"
conda env remove -y --name $env_name || true
conda create --name $env_name python=$python_version pip -y
conda activate $env_name
pip install --upgrade pip
# Install libraries
# TODO: (optional) install PyTorch if you use it, preferably using conda; check https://pytorch.org/get-started/locally/ for the latest command
pip install -r requirements.txt
# pip install -e .[dev]
}
function prepare_local_env() {
echo "About to install the necessary Python libraries in the current pip environment."
read -p "Enter \"yes\" to confirm: " confirm
if [ "$confirm" = "yes" ]; then
pip install -r requirements.txt
exit 0
fi
echo "Aborting installation."
}
function main() {
local option=${1:-local}
shift
case $option in
conda)
prepare_conda_env $@
;;
local)
prepare_local_env
;;
*)
echo "Usage: $(basename $0): Installs the necessary Python libraries..."
echo "local(default): in the current python environment, it's recommended to create and activate a Python virtualenv first."
echo "conda: in a conda environment called "mole"."
echo "nvcc is required to install and use flash-attn."
exit 1
;;
esac
}
main $@