# Copyright 2024 Jinchuan Tian, Carnegie Mellon University, jinchuat@andrew.cmu.edu | |
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | |
# Build environment for SpeechLM infernece | |
log() { | |
local fname=${BASH_SOURCE[1]##*/} | |
echo -e "$(date '+%Y-%m-%dT%H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | |
} | |
stage=2 | |
stop_stage=100 | |
. utils/parse_options.sh | |
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then | |
log "Build Python environment" | |
bash utils/setup_anaconda.sh miniconda3 speechlm 3.10 | |
fi | |
if [ ! -f activate_python.sh ]; then | |
log "Please run the first stage to install conda environment" && exit 1; | |
else | |
. ./activate_python.sh | |
fi | |
if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then | |
log "Install Pytorch and related packages" | |
conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.4 -c pytorch -c nvidia -y | |
pip install transformers huggingface-hub | |
fi | |
if [ ${stage} -le 3 ] && [ ${stop_stage} -ge 3 ]; then | |
log "Install ESPnet" | |
git clone --branch speechlm https://github.com/jctian98/espnet.git | |
cd espnet; git checkout 33f25ed9b8ca79d8e31815b47836839280697035 | |
pip install . | |
cd .. | |
fi | |