From 357572595676b2b1cb48c2468f9ce085d3ae47c0 Mon Sep 17 00:00:00 2001 From: kamo-naoyuki Date: Fri, 3 Feb 2023 01:19:51 +0900 Subject: [PATCH] Add pytorch=1.13.1 to CI configuration --- .github/workflows/centos7.yml | 2 +- .github/workflows/ci.yaml | 6 +- .github/workflows/debian9.yml | 2 +- .github/workflows/doc.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/test_import.yaml | 2 +- .github/workflows/windows.yml | 2 +- .mergify.yml | 7 +- README.md | 16 +- tools/Makefile | 2 +- tools/installers/install_torch.sh | 272 +++++++++++++++++++---------- 11 files changed, 206 insertions(+), 109 deletions(-) diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 3d62ef9259e..28daf7ec254 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -19,7 +19,7 @@ jobs: # ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found # (required by /__w/espnet/espnet/tools/venv/envs/espnet/lib/python3.6/site-packages/pyworld/pyworld.cpython-36m-x86_64-linux-gnu.so) # NOTE(kamo): The issue doens't exist for python3.7? - TH_VERSION: 1.12.1 + TH_VERSION: 1.13.1 CHAINER_VERSION: 6.0.0 USE_CONDA: true CC: /opt/rh/devtoolset-7/root/usr/bin/gcc diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed1f5a34f92..831f83f1f31 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,19 +16,19 @@ jobs: matrix: os: [ubuntu-18.04] python-version: [3.7] - pytorch-version: [1.4.0, 1.5.1, 1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.2, 1.11.0, 1.12.1] + pytorch-version: [1.4.0, 1.5.1, 1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.2, 1.11.0, 1.12.1, 1.13.1] chainer-version: [6.0.0] # NOTE(kamo): Conda is tested by Circle-CI use-conda: [false] include: - os: ubuntu-20.04 python-version: 3.8 - pytorch-version: 1.12.1 + pytorch-version: 1.13.1 chainer-verssion: 6.0.0 use-conda: false - os: ubuntu-20.04 python-version: 3.9 - pytorch-version: 1.12.1 + pytorch-version: 1.13.1 chainer-verssion: 6.0.0 use-conda: false steps: diff --git a/.github/workflows/debian9.yml b/.github/workflows/debian9.yml index 5c9c4a437a6..1b14baef923 100644 --- a/.github/workflows/debian9.yml +++ b/.github/workflows/debian9.yml @@ -15,7 +15,7 @@ jobs: image: debian:9 env: ESPNET_PYTHON_VERSION: 3.7 - TH_VERSION: 1.12.1 + TH_VERSION: 1.13.1 CHAINER_VERSION: 6.0.0 USE_CONDA: true CC: gcc-6 diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index beb3cd8debd..cc0ec357983 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -30,7 +30,7 @@ jobs: - name: install espnet env: ESPNET_PYTHON_VERSION: 3.8 - TH_VERSION: 1.12.1 + TH_VERSION: 1.13.1 CHAINER_VERSION: 6.0.0 USE_CONDA: false CC: gcc-7 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5105cf8afd4..73a544d0ed6 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: python-version: [3.9] - pytorch-version: [1.12.1] + pytorch-version: [1.13.1] use-conda: [true, false] steps: - uses: actions/checkout@master diff --git a/.github/workflows/test_import.yaml b/.github/workflows/test_import.yaml index 25d64b480dd..a3ef836ec5d 100644 --- a/.github/workflows/test_import.yaml +++ b/.github/workflows/test_import.yaml @@ -16,7 +16,7 @@ jobs: matrix: os: [ubuntu-latest] python-version: [3.9] - pytorch-version: [1.12.1] + pytorch-version: [1.13.1] steps: - uses: actions/checkout@v2 - name: Set up Python diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 915b6f50176..52815406251 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: python-version: [3.9] - pytorch-version: [1.12.1] + pytorch-version: [1.13.1] defaults: run: shell: bash diff --git a/.mergify.yml b/.mergify.yml index 9d5baf435f5..461ff7fdafb 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -13,9 +13,10 @@ pull_request_rules: - "check-success=linter_and_test (ubuntu-18.04, 3.7, 1.10.2, 6.0.0, false)" - "check-success=linter_and_test (ubuntu-18.04, 3.7, 1.11.0, 6.0.0, false)" - "check-success=linter_and_test (ubuntu-18.04, 3.7, 1.12.1, 6.0.0, false)" - - "check-success=linter_and_test (ubuntu-20.04, 3.8, 1.12.1, false, 6.0.0)" - - "check-success=linter_and_test (ubuntu-20.04, 3.9, 1.12.1, false, 6.0.0)" - - "check-success=test_import (ubuntu-latest, 3.9, 1.12.1)" + - "check-success=linter_and_test (ubuntu-18.04, 3.7, 1.13.1, 6.0.0, false)" + - "check-success=linter_and_test (ubuntu-20.04, 3.8, 1.13.1, false, 6.0.0)" + - "check-success=linter_and_test (ubuntu-20.04, 3.9, 1.13.1, false, 6.0.0)" + - "check-success=test_import (ubuntu-latest, 3.9, 1.13.1)" actions: merge: method: merge diff --git a/README.md b/README.md index a160b897815..ba5863e02c1 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ # ESPnet: end-to-end speech processing toolkit -|system/pytorch ver.|1.4.0|1.5.1|1.6.0|1.7.1|1.8.1|1.9.1|1.10.2|1.11.0|1.12.1| -| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -|ubuntu20/python3.9/pip|||||||||[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)| -|ubuntu20/python3.8/pip|||||||||[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)| -|ubuntu18/python3.7/pip|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)| -|debian9/python3.7/conda|||||||||[![debian9](https://github.com/espnet/espnet/workflows/debian9/badge.svg)](https://github.com/espnet/espnet/actions?query=workflow%3Adebian9)| -|centos7/python3.7/conda|||||||||[![centos7](https://github.com/espnet/espnet/workflows/centos7/badge.svg)](https://github.com/espnet/espnet/actions?query=workflow%3Acentos7)| -|doc/python3.8|||||||||[![doc](https://github.com/espnet/espnet/workflows/doc/badge.svg)](https://github.com/espnet/espnet/actions?query=workflow%3Adoc)| +|system/pytorch ver.|1.4.0|1.5.1|1.6.0|1.7.1|1.8.1|1.9.1|1.10.2|1.11.0|1.12.1|1.13.1| +| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | +|ubuntu20/python3.9/pip||||||||||[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)| +|ubuntu20/python3.8/pip||||||||||[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)| +|ubuntu18/python3.7/pip|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)|[![Github Actions](https://github.com/espnet/espnet/workflows/CI/badge.svg)](https://github.com/espnet/espnet/actions)| +|debian9/python3.7/conda||||||||||[![debian9](https://github.com/espnet/espnet/workflows/debian9/badge.svg)](https://github.com/espnet/espnet/actions?query=workflow%3Adebian9)| +|centos7/python3.7/conda||||||||||[![centos7](https://github.com/espnet/espnet/workflows/centos7/badge.svg)](https://github.com/espnet/espnet/actions?query=workflow%3Acentos7)| +|doc/python3.8||||||||||[![doc](https://github.com/espnet/espnet/workflows/doc/badge.svg)](https://github.com/espnet/espnet/actions?query=workflow%3Adoc)| [![PyPI version](https://badge.fury.io/py/espnet.svg)](https://badge.fury.io/py/espnet) diff --git a/tools/Makefile b/tools/Makefile index e98cb8ebde2..9e14f3aa20d 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ # PyTorch version: 1.4.0, 1.5.1, 1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.0, 1.10.1, 1.11.0 and 1.12.1 are tested. -TH_VERSION := 1.12.1 +TH_VERSION := 1.13.1 # Use pip for pytorch installation even if you have anaconda ifneq ($(shell test -f ./activate_python.sh && grep 'conda activate' ./activate_python.sh),) diff --git a/tools/installers/install_torch.sh b/tools/installers/install_torch.sh index 54b23451c7e..93938979f3d 100755 --- a/tools/installers/install_torch.sh +++ b/tools/installers/install_torch.sh @@ -70,61 +70,51 @@ else: EOF } install_torch(){ -# Usage: install_torch +# Usage: install_torch if "${use_conda}"; then - if [ -z "${cuda_version}" ]; then - log conda install -y "pytorch=${torch_version}" "torchaudio=$1" cpuonly -c pytorch - conda install -y "pytorch=${torch_version}" "torchaudio=$1" cpuonly -c pytorch - elif [ "${cuda_version}" = "11.5" ] || [ "${cuda_version}" = "11.6" ]; then - # NOTE(kamo): In my environment, cudatoolkit of conda-forge only could be installed, but I don't know why @ 12, May, 2022 - cudatoolkit_channel=conda-forge - log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" - conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" - - elif [ "${cuda_version}" = "11.1" ] || [ "${cuda_version}" = "11.2" ]; then - # Anaconda channel, which is default main channel, doesn't provide cudatoolkit=11.1, 11.2 now (Any pytorch version doesn't provide cuda=11.2). - # https://anaconda.org/anaconda/cudatoolkit/files - - # https://anaconda.org/nvidia/cudatoolkit/files - cudatoolkit_channel=nvidia - - # https://anaconda.org/conda-forge/cudatoolkit/files - # cudatoolkit_channel=conda-forge - - log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" - conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" - else - log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch - conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch - fi - else - if $(pytorch_plus 1.10.0); then + if $(pytorch_plus 1.13.0); then if [ -z "${cuda_version}" ]; then - log python3 -m pip install "torch==${torch_version}${pip_cpu_module_suffix}" "torchaudio==$1${pip_cpu_module_suffix}" -f https://download.pytorch.org/whl/torch_stable.html - python3 -m pip install "torch==${torch_version}${pip_cpu_module_suffix}" "torchaudio==$1${pip_cpu_module_suffix}" -f https://download.pytorch.org/whl/torch_stable.html + log conda install -y "pytorch=${torch_version}" "torchaudio=$1" cpuonly -c pytorch + conda install -y "pytorch=${torch_version}" "torchaudio=$1" cpuonly -c pytorch else - if [ "${cuda_version}" = "$2" ]; then - log python3 -m pip install "torch==${torch_version}" "torchaudio==$1" - python3 -m pip install "torch==${torch_version}" "torchaudio==$1" - else - log python3 -m pip install "torch==${torch_version}+cu${cuda_version_without_dot}" "torchaudio==$1+cu${cuda_version_without_dot}" -f "https://download.pytorch.org/whl/torch_stable.html" - python3 -m pip install "torch==${torch_version}+cu${cuda_version_without_dot}" "torchaudio==$1+cu${cuda_version_without_dot}" -f "https://download.pytorch.org/whl/torch_stable.html" - fi + log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "pytorch-cuda=${cuda_version}" -c pytorch -c nvidia + conda install -y "pytorch=${torch_version}" "torchaudio=$1" "pytorch-cuda=${cuda_version}" -c pytorch -c nvidia fi else if [ -z "${cuda_version}" ]; then - log python3 -m pip install "torch==${torch_version}${pip_cpu_module_suffix}" "torchaudio==$1" -f https://download.pytorch.org/whl/torch_stable.html - python3 -m pip install "torch==${torch_version}${pip_cpu_module_suffix}" "torchaudio==$1" -f https://download.pytorch.org/whl/torch_stable.html + log conda install -y "pytorch=${torch_version}" "torchaudio=$1" cpuonly -c pytorch + conda install -y "pytorch=${torch_version}" "torchaudio=$1" cpuonly -c pytorch + elif [ "${cuda_version}" = "11.5" ] || [ "${cuda_version}" = "11.6" ]; then + # NOTE(kamo): In my environment, cudatoolkit of conda-forge only could be installed, but I don't know why @ 12, May, 2022 + cudatoolkit_channel=conda-forge + log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" + conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" + + elif [ "${cuda_version}" = "11.1" ] || [ "${cuda_version}" = "11.2" ]; then + # Anaconda channel, which is default main channel, doesn't provide cudatoolkit=11.1, 11.2 now (Any pytorch version doesn't provide cuda=11.2). + # https://anaconda.org/anaconda/cudatoolkit/files + + # https://anaconda.org/nvidia/cudatoolkit/files + cudatoolkit_channel=nvidia + + # https://anaconda.org/conda-forge/cudatoolkit/files + # cudatoolkit_channel=conda-forge + + log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" + conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch -c "${cudatoolkit_channel}" else - if [ "${cuda_version}" = "$2" ]; then - log python3 -m pip install "torch==${torch_version}" "torchaudio==$1" - python3 -m pip install "torch==${torch_version}" "torchaudio==$1" - else - log python3 -m pip install "torch==${torch_version}+cu${cuda_version_without_dot}" "torchaudio==$1" -f "https://download.pytorch.org/whl/torch_stable.html" - python3 -m pip install "torch==${torch_version}+cu${cuda_version_without_dot}" "torchaudio==$1" -f "https://download.pytorch.org/whl/torch_stable.html" - fi + log conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch + conda install -y "pytorch=${torch_version}" "torchaudio=$1" "cudatoolkit=${cuda_version}" -c pytorch fi fi + else + if [ -z "${cuda_version}" ]; then + log python3 -m pip install "torch==${torch_version}" "torchaudio==$1" --extra-index-url https://download.pytorch.org/whl/cpu + python3 -m pip install "torch==${torch_version}" "torchaudio==$1" --extra-index-url https://download.pytorch.org/whl/cpu + else + log python3 -m pip install "torch==${torch_version}" "torchaudio==$1" --extra-index-url https://download.pytorch.org/whl/cu"${cuda_version_without_dot}" + python3 -m pip install "torch==${torch_version}" "torchaudio==$1" --extra-index-url https://download.pytorch.org/whl/cu"${cuda_version_without_dot}" + fi fi } check_python_version(){ @@ -139,9 +129,9 @@ check_cuda_version(){ [ "${cuda_version}" = "${v}" ] && supported=true done if ! "${supported}"; then - # See https://anaconda.org/pytorch/pytorch/files to provided version - log "[ERROR] Pytorch=${torch_version} binary for CUDA=${cuda_version} is not provided. $@ are supported." - exit 1 + # See https://anaconda.org/pytorch/pytorch/files to confirm the provided versions + log "[WARNING] Pre-build package for Pytorch=${torch_version} with CUDA=${cuda_version} is not provided." + return 1 fi } @@ -154,39 +144,93 @@ if ! python -c "import packaging.version" &> /dev/null; then python3 -m pip install packaging fi -if $(pytorch_plus 1.12.2); then +if $(pytorch_plus 1.13.2); then log "[ERROR] This script doesn't support pytorch=${torch_version}" exit 1 +elif $(pytorch_plus 1.13.1); then + check_python_version 3.11 # Error if python>= + if ! check_cuda_version 11.7 11.6; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.7" + cuda_version=11.7 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.13.1 # install_torch + +elif $(pytorch_plus 1.13.0); then + check_python_version 3.11 # Error if python>= + if ! check_cuda_version 11.7 11.6; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.7" + cuda_version=11.7 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.13.0 # install_torch + +elif $(pytorch_plus 1.12.2); then + log "[ERROR] pytorch=${torch_version} doesn't exist" + exit 1 + elif $(pytorch_plus 1.12.1); then check_python_version 3.11 # Error if python>= - check_cuda_version 11.6 11.3 10.2 # Error if cuda_version doesn't match with any given numbers - install_torch 0.12.1 10.2 # install_torch + if ! check_cuda_version 11.6 11.3 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.6" + cuda_version=11.6 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.12.1 # install_torch elif $(pytorch_plus 1.12.0); then check_python_version 3.11 # Error if python>= - check_cuda_version 11.6 11.3 10.2 # Error if cuda_version doesn't match with any given numbers - install_torch 0.12.0 10.2 # install_torch + if ! check_cuda_version 11.6 11.3 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.6" + cuda_version=11.6 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.12.0 # install_torch + +elif $(pytorch_plus 1.11.1); then + log "[ERROR] pytorch=${torch_version} doesn't exist" + exit 1 elif $(pytorch_plus 1.11.0); then check_python_version 3.11 # Error if python>= - check_cuda_version 11.5 11.3 11.1 10.2 # Error if cuda_version doesn't match with any given numbers - install_torch 0.11.0 10.2 # install_torch + if ! check_cuda_version 11.5 11.3 11.1 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.5" + cuda_version=11.5 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.11.0 # install_torch + +elif $(pytorch_plus 1.10.3); then + log "[ERROR] pytorch=${torch_version} doesn't exist" + exit 1 elif $(pytorch_plus 1.10.2); then check_python_version 3.10 # Error if python>= - check_cuda_version 11.3 11.1 10.2 # Error if cuda_version doesn't match with any given numbers - install_torch 0.10.2 10.2 # install_torch + if ! check_cuda_version 11.3 11.1 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.3" + cuda_version=11.3 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.10.2 # install_torch elif $(pytorch_plus 1.10.1); then check_python_version 3.10 # Error if python>= - check_cuda_version 11.3 11.1 10.2 # Error if cuda_version doesn't match with any given numbers - install_torch 0.10.1 10.2 # install_torch + if ! check_cuda_version 11.3 11.1 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.3" + cuda_version=11.3 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.10.1 # install_torch elif $(pytorch_plus 1.10.0); then check_python_version 3.11 # Error if python>= - check_cuda_version 11.3 11.1 10.2 # Error if cuda_version doesn't match with any given numbers - install_torch 0.10.0 10.2 # install_torch + if ! check_cuda_version 11.3 11.1 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.3" + cuda_version=11.3 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.10.0 # install_torch elif $(pytorch_plus 1.9.2); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -194,13 +238,21 @@ elif $(pytorch_plus 1.9.2); then elif $(pytorch_plus 1.9.1); then check_python_version 3.10 - check_cuda_version 11.1 10.2 - install_torch 0.9.1 10.2 + if ! check_cuda_version 11.1 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.1" + cuda_version=11.7 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.9.1 elif $(pytorch_plus 1.9.0); then check_python_version 3.10 - check_cuda_version 11.1 10.2 - install_torch 0.9.0 10.2 + if ! check_cuda_version 11.1 10.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.1" + cuda_version=11.1 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.9.0 elif $(pytorch_plus 1.8.2); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -208,13 +260,21 @@ elif $(pytorch_plus 1.8.2); then elif $(pytorch_plus 1.8.1); then check_python_version 3.10 - check_cuda_version 11.1 10.2 10.1 - install_torch 0.8.1 10.2 + if ! check_cuda_version 11.1 10.2 10.1; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.1" + cuda_version=11.1 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.8.1 elif $(pytorch_plus 1.8.0); then check_python_version 3.10 - check_cuda_version 11.1 10.2 10.1 - install_torch 0.8.0 10.2 + if ! check_cuda_version 11.1 10.2 10.1; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.1" + cuda_version=11.1 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.8.0 elif $(pytorch_plus 1.7.2); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -222,13 +282,21 @@ elif $(pytorch_plus 1.7.2); then elif $(pytorch_plus 1.7.1); then check_python_version 3.10 - check_cuda_version 11.0 10.2 10.1 9.2 - install_torch 0.7.2 10.2 + if ! check_cuda_version 11.0 10.2 10.1 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.0" + cuda_version=11.0 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.7.2 elif $(pytorch_plus 1.7.0); then check_python_version 3.10 - check_cuda_version 11.0 10.2 10.1 9.2 - install_torch 0.7.0 10.2 + if ! check_cuda_version 11.0 10.2 10.1 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=11.0" + cuda_version=11.0 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.7.0 elif $(pytorch_plus 1.6.1); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -236,8 +304,12 @@ elif $(pytorch_plus 1.6.1); then elif $(pytorch_plus 1.6.0); then check_python_version 3.9 - check_cuda_version 10.2 10.1 9.2 - install_torch 0.6.0 10.2 + if ! check_cuda_version 10.2 10.1 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.2" + cuda_version=10.2 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.6.0 elif $(pytorch_plus 1.5.2); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -245,13 +317,21 @@ elif $(pytorch_plus 1.5.2); then elif $(pytorch_plus 1.5.1); then check_python_version 3.9 - check_cuda_version 10.2 10.1 9.2 - install_torch 0.5.1 10.2 + if ! check_cuda_version 10.2 10.1 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.2" + cuda_version=10.2 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.5.1 elif $(pytorch_plus 1.5.0); then check_python_version 3.9 - check_cuda_version 10.2 10.1 9.2 - install_torch 0.5.0 10.2 + if ! check_cuda_version 10.2 10.1 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.2" + cuda_version=10.2 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.5.0 elif $(pytorch_plus 1.4.1); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -259,8 +339,12 @@ elif $(pytorch_plus 1.4.1); then elif $(pytorch_plus 1.4.0); then check_python_version 3.9 - check_cuda_version 10.1 10.0 9.2 - install_torch 0.4.0 10.1 + if ! check_cuda_version 10.1 10.0 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.1" + cuda_version=10.1 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.4.0 elif $(pytorch_plus 1.3.2); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -268,13 +352,21 @@ elif $(pytorch_plus 1.3.2); then elif $(pytorch_plus 1.3.1); then check_python_version 3.8 - check_cuda_version 10.1 10.0 9.2 - install_torch 0.3.2 10.1 + if ! check_cuda_version 10.1 10.0 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.1" + cuda_version=10.1 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.3.2 elif $(pytorch_plus 1.3.0); then check_python_version 3.8 - check_cuda_version 10.1 10.0 9.2 - install_torch 0.3.1 10.1 + if ! check_cuda_version 10.1 10.0 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.1" + cuda_version=10.1 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.3.1 elif $(pytorch_plus 1.2.1); then log "[ERROR] pytorch=${torch_version} doesn't exist" @@ -282,8 +374,12 @@ elif $(pytorch_plus 1.2.1); then elif $(pytorch_plus 1.2.0); then check_python_version 3.8 - check_cuda_version 10.0 9.2 - install_torch 0.3.0 10.0 + if ! check_cuda_version 10.0 9.2; then + log "[INFO] Fallback: cuda_version=${cuda_version} -> cuda_version=10.0" + cuda_version=10.0 + cuda_version_without_dot="${cuda_version/\./}" + fi + install_torch 0.3.0 else log "[ERROR] This script doesn't support pytorch=${torch_version}" exit 1