|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +declare -a TORCHAUDIO_VERSIONS=("0.6.0") |
| 4 | +declare -a PYTHON_VERSIONS=("3.6" "3.7" "3.8") |
| 5 | + |
| 6 | +export TORCHAUDIO_VERSIONS |
| 7 | +export PYTHON_VERSIONS |
| 8 | + |
| 9 | +export KALDI_ROOT="${KALDI_ROOT:-$HOME}" # Just to disable warning emitted from kaldi_io |
| 10 | + |
| 11 | +_this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| 12 | +_root_dir="$(git rev-parse --show-toplevel)" |
| 13 | +_conda_dir="${_root_dir}/conda" |
| 14 | +case "$(uname -s)" in |
| 15 | + Darwin*) _os="MacOSX";; |
| 16 | + *) _os="Linux" |
| 17 | +esac |
| 18 | + |
| 19 | +install_conda() { |
| 20 | + if [ ! -d "${_conda_dir}" ]; then |
| 21 | + printf "* Installing conda\n" |
| 22 | + wget -nv -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${_os}-x86_64.sh" |
| 23 | + bash ./miniconda.sh -b -f -p "${_conda_dir}" |
| 24 | + rm miniconda.sh |
| 25 | + fi |
| 26 | +} |
| 27 | + |
| 28 | +init_conda() { |
| 29 | + eval "$("${_conda_dir}/bin/conda" shell.bash hook)" |
| 30 | +} |
| 31 | + |
| 32 | +get_name() { |
| 33 | + echo "${1}-py${2}" |
| 34 | +} |
| 35 | + |
| 36 | +get_env_dir() { |
| 37 | + echo "${_root_dir}/envs/$(get_name "$1" "$2")" |
| 38 | +} |
| 39 | + |
| 40 | +create_env() { |
| 41 | + env_dir="$(get_env_dir "$1" "$2")" |
| 42 | + if [ ! -d "${env_dir}" ]; then |
| 43 | + printf "* Creating environment torchaudio: %s, Python: %s\n" "$1" "$2" |
| 44 | + conda create -q --prefix "${env_dir}" -y python="$2" |
| 45 | + fi |
| 46 | +} |
| 47 | + |
| 48 | +activate_env() { |
| 49 | + printf "* Activating environment torchaudio: %s, Python: %s\n" "$1" "$2" |
| 50 | + conda activate "$(get_env_dir "$1" "$2")" |
| 51 | +} |
| 52 | + |
| 53 | +install_release() { |
| 54 | + printf "* Installing torchaudio: %s\n" "$1" |
| 55 | + conda install -y -q torchaudio="$1" packaging -c pytorch |
| 56 | + # packaging is required in test to validate the torchaudio version for dump |
| 57 | +} |
| 58 | + |
| 59 | +install_build_dependencies() { |
| 60 | + printf "* Installing torchaudio dependencies except PyTorch - (Python: %s)\n" "$1" |
| 61 | + conda env update -q --file "${_this_dir}/environment.yml" --prune |
| 62 | + if [ "${_os}" == Linux ]; then |
| 63 | + pip install clang-format |
| 64 | + fi |
| 65 | +} |
| 66 | + |
| 67 | +build_master() { |
| 68 | + printf "* Installing PyTorch (py%s)\n" "$1" |
| 69 | + conda install -y -q pytorch "cpuonly" -c pytorch-nightly |
| 70 | + printf "* Installing torchaudio\n" |
| 71 | + cd "${_root_dir}" || exit 1 |
| 72 | + BUILD_SOX=1 python setup.py clean install |
| 73 | +} |
0 commit comments