install.sh 1.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
#!/usr/bin/env bash

unset PYTORCH_VERSION
# For unittest, nightly PyTorch is used as the following section,
# so no need to set PYTORCH_VERSION.
# In fact, keeping PYTORCH_VERSION forces us to hardcode PyTorch version in config.

set -e

moto's avatar
moto committed
10
11
12
root_dir="$(git rev-parse --show-toplevel)"
conda_dir="${root_dir}/conda"
env_dir="${root_dir}/env"
13

moto's avatar
moto committed
14
15
16
17
18
19
20
21
22
23
24
25
cd "${root_dir}"

case "$(uname -s)" in
    Darwin*) os=MacOSX;;
    *) os=Linux
esac

# 0. Activate conda env
eval "$("${conda_dir}/bin/conda" shell.bash hook)"
conda activate "${env_dir}"

# 1. Install PyTorch
moto's avatar
moto committed
26
if [ -z "${CUDA_VERSION:-}" ] ; then
moto's avatar
moto committed
27
28
29
30
31
    if [ "${os}" == MacOSX ] ; then
        cudatoolkit=''
    else
        cudatoolkit="cpuonly"
    fi
moto's avatar
moto committed
32
33
34
35
36
else
    version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
    cudatoolkit="cudatoolkit=${version}"
fi
printf "Installing PyTorch with %s\n" "${cudatoolkit}"
moto's avatar
moto committed
37
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" pytorch ${cudatoolkit}
38

moto's avatar
moto committed
39
# 2. Install torchaudio
40
printf "* Installing torchaudio\n"
moto's avatar
moto committed
41
git submodule update --init --recursive
42
BUILD_TRANSDUCER=1 BUILD_SOX=1 python setup.py install
moto's avatar
moto committed
43
44
45
46
47

# 3. Install Test tools
printf "* Installing test tools\n"
if [ "${os}" == Linux ] ; then
    conda install -y -c conda-forge codecov pytest pytest-cov
48
    pip install kaldi-io 'librosa>=0.8.0' parameterized SoundFile scipy 'requests>=2.20'
moto's avatar
moto committed
49
50
51
else
    # Note: installing librosa via pip fail because it will try to compile numba.
    conda install -y -c conda-forge codecov pytest pytest-cov 'librosa>=0.8.0' parameterized scipy
52
    pip install kaldi-io SoundFile 'requests>=2.20'
moto's avatar
moto committed
53
fi