-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.sh
42 lines (35 loc) · 1.26 KB
/
setup.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
41
42
#!/bin/bash
set -e
# setup conda
source ~/miniconda3/etc/profile.d/conda.sh
## create conda env
read -rp "Enter environment name: " env_name
read -rp "Enter python version (must be >=3.8): " python_version
conda create -yn "$env_name" python="$python_version"
conda activate "$env_name"
# install torch
read -rp "Enter torch version (check it is compatible with all your requirements): " torch_version
read -rp "Enter cuda version (10.2, 11.3 or none to avoid installing cuda support. Not sure? Check out https://stackoverflow.com/a/68499241/1908499): " cuda_version
if [ "$cuda_version" == "none" ]; then
conda install -y pytorch=$torch_version torchvision cpuonly -c pytorch
else
conda install -y pytorch=$torch_version torchvision cudatoolkit=$cuda_version -c pytorch
fi
# install python requirements
pip install -e .
classy --install-autocomplete
echo "Classy successfully installed. Don't forget to activate your environment!"
echo "$> conda activate ${env_name}"
# install contributor dependencies
read -p "Install contributor dependencies? [y/N] "
if [[ $REPLY =~ ^[Yy]$ ]]
then
# install black
pip install black
# install pytest
pip install pytest
# install and hook pre-commit
pip install pre-commit
pre-commit install
pre-commit run --all-files
fi