Commit fce431cd authored by Yi Zhang's avatar Yi Zhang Committed by Facebook GitHub Bot
Browse files

improve installing nightly pytorch (#2026)

Summary:
Similar to https://github.com/pytorch/vision/pull/4788
Make sure the workflow could download right PyTorch with cpu or cuda in case nightly build wasn't ready at that day.

https://app.circleci.com/pipelines/github/pytorch/audio/8427/workflows/11a80738-bcdd-45e3-b37f-328be36c60ee/jobs/438285?invite=true#step-107-542

![image](https://user-images.githubusercontent.com/16190118/142969390-142df7ec-6040-40c1-9a02-17d43f5de05e.png)

Pull Request resolved: https://github.com/pytorch/audio/pull/2026

Reviewed By: hwangjeff, nateanl

Differential Revision: D32634926

Pulled By: mthrok

fbshipit-source-id: 30d6349a0a2ce174b789a5888b1c8e0544a23a37
parent 9392c9e0
...@@ -29,21 +29,25 @@ if [ -z "${CUDA_VERSION:-}" ] ; then ...@@ -29,21 +29,25 @@ if [ -z "${CUDA_VERSION:-}" ] ; then
else else
cudatoolkit="cpuonly" cudatoolkit="cpuonly"
fi fi
version="cpu"
else else
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")" version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}" cudatoolkit="cudatoolkit=${version}"
fi fi
printf "Installing PyTorch with %s\n" "${cudatoolkit}" printf "Installing PyTorch with %s\n" "${cudatoolkit}"
( (
if [ "${os}" == MacOSX ] ; then if [ "${os}" == MacOSX ] ; then
# TODO: this can be removed as soon as linking issue could be resolved # TODO: this can be removed as soon as linking issue could be resolved
# see https://github.com/pytorch/pytorch/issues/62424 from details # see https://github.com/pytorch/pytorch/issues/62424 from details
MKL_CONSTRAINT='mkl==2021.2.0' MKL_CONSTRAINT='mkl==2021.2.0'
pytorch_build=pytorch
else else
MKL_CONSTRAINT='' MKL_CONSTRAINT=''
pytorch_build="pytorch[build="*${version}*"]"
fi fi
set -x set -x
conda install ${CONDA_CHANNEL_FLAGS:-} -y -c "pytorch-${UPLOAD_CHANNEL}" $MKL_CONSTRAINT "pytorch-${UPLOAD_CHANNEL}::pytorch" ${cudatoolkit} conda install ${CONDA_CHANNEL_FLAGS:-} -y -c "pytorch-${UPLOAD_CHANNEL}" $MKL_CONSTRAINT "pytorch-${UPLOAD_CHANNEL}::${pytorch_build}" ${cudatoolkit}
) )
# 2. Install torchaudio # 2. Install torchaudio
......
...@@ -23,12 +23,13 @@ source "$this_dir/set_cuda_envs.sh" ...@@ -23,12 +23,13 @@ source "$this_dir/set_cuda_envs.sh"
# 1. Install PyTorch # 1. Install PyTorch
if [ -z "${CUDA_VERSION:-}" ] ; then if [ -z "${CUDA_VERSION:-}" ] ; then
cudatoolkit="cpuonly" cudatoolkit="cpuonly"
version="cpu"
else else
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")" version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
cudatoolkit="cudatoolkit=${version}" cudatoolkit="cudatoolkit=${version}"
fi fi
printf "Installing PyTorch with %s\n" "${cudatoolkit}" printf "Installing PyTorch with %s\n" "${cudatoolkit}"
conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch "${cudatoolkit}" pytest conda install -y -c "pytorch-${UPLOAD_CHANNEL}" -c conda-forge "pytorch-${UPLOAD_CHANNEL}"::pytorch[build="*${version}*"] "${cudatoolkit}" pytest
torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())") torch_cuda=$(python -c "import torch; print(torch.cuda.is_available())")
echo torch.cuda.is_available is $torch_cuda echo torch.cuda.is_available is $torch_cuda
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment