Skip to content

Commit 3bef4f5

Browse files
committed
install script
0 parents  commit 3bef4f5

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.done-*
2+
env.sh
3+
venv
4+
Miniconda3-latest-Linux-x86_64.sh
5+
Miniconda3-py38_4.9.2-Linux-x86_64.sh
6+
kaldi
7+
corpora
8+
kaldifeat
9+
*.egg-info/

install.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
nj=$(nproc)
6+
7+
home=$PWD
8+
9+
# python/CONDA
10+
conda_url=https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
11+
conda_url=https://repo.anaconda.com/miniconda/Miniconda3-py38_4.9.2-Linux-x86_64.sh
12+
13+
# PYTORCH version
14+
torch_version=1.8.2
15+
torchvision_version=0.9.2
16+
torchaudio_version=0.8.2
17+
torch_wheels="https://download.pytorch.org/whl/lts/1.8/torch_lts.html"
18+
19+
# CUDA version
20+
cuda_version=10.2
21+
22+
23+
venv_dir=$PWD/venv
24+
25+
mark=.done-venv
26+
if [ ! -f $mark ]; then
27+
echo " == Making python virtual environment =="
28+
name=$(basename $conda_url)
29+
if [ ! -f $name ]; then
30+
wget $conda_url || exit 1
31+
fi
32+
[ ! -f $name ] && echo "File $name does not exist" && exit 1
33+
[ -d $venv_dir ] && rm -r $venv_dir
34+
sh $name -b -p $venv_dir || exit 1
35+
. $venv_dir/bin/activate
36+
37+
echo "Installing conda dependencies"
38+
yes | conda install -c conda-forge sox || exit 1
39+
yes | conda install -c conda-forge libflac || exit 1
40+
yes | conda install -c conda-forge cudatoolkit=$cuda_version || exit 1
41+
touch $mark
42+
fi
43+
source $venv_dir/bin/activate
44+
45+
exit 0
46+
47+
# CUDA version
48+
CUDAROOT=/usr/local/cuda
49+
if [ "$(id -g --name)" == "lium" ]; then
50+
CUDAROOT=/opt/cuda/10.2 # LIUM Cluster
51+
echo "Using local \$CUDAROOT: $CUDAROOT"
52+
fi
53+
_cuda_version=$($CUDAROOT/bin/nvcc --version | grep "Cuda compilation tools" | cut -d" " -f5 | sed s/,//)
54+
if [[ $cuda_version != $_cuda_version ]]; then
55+
echo "CUDA env not properly setup! (installed cuda v$cuda_version != in path cuda v$_cuda_version)"
56+
exit 1
57+
fi
58+
cuda_version_witout_dot=$(echo $cuda_version | xargs | sed 's/\.//')
59+
60+
export PATH=$CUDAROOT/bin:$PATH
61+
export LD_LIBRARY_PATH=$CUDAROOT/lib64:$LD_LIBRARY_PATH
62+
export CFLAGS="-I$CUDAROOT/include $CFLAGS"
63+
export CUDA_HOME=$CUDAROOT
64+
export CUDA_PATH=$CUDAROOT
65+
echo "if [ \$(which python) != $venv_dir/bin/python ]; then source $venv_dir/bin/activate; fi; export CUDAROOT=$CUDAROOT; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH;" > env.sh
66+
67+
mark=.done-pytorch
68+
if [ ! -f $mark ]; then
69+
echo " == Installing pytorch $torch_version for cuda $cuda_version =="
70+
pip3 install torch==$torch_version+cu$cuda_version_witout_dot torchvision==$torchvision_version+cu$cuda_version_witout_dot torchaudio==$torchaudio_version -f $torch_wheels
71+
cd $home
72+
touch $mark
73+
fi
74+
75+
mark=.done-python-requirements
76+
if [ ! -f $mark ]; then
77+
echo " == Installing python libraries =="
78+
79+
# sidekit additional req
80+
pip3 install matplotlib==3.4.3
81+
pip3 install SoundFile==0.10.3.post1
82+
pip3 install PyYAML==5.4.1
83+
pip3 install h5py==3.2.1
84+
pip3 install ipython==7.27.0
85+
86+
cd $home
87+
touch $mark
88+
fi
89+
90+
mark=.done-sidekit
91+
if [ ! -f $mark ]; then
92+
echo " == Building sidekit =="
93+
cd sidekit
94+
pip3 install -e .
95+
cd $home
96+
touch $mark
97+
fi
98+
99+
echo " == Everything got installed successfully =="

0 commit comments

Comments
 (0)