From e485c5749b5d9bf725dcc4d18b8b825e8f2536e0 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 18 Oct 2024 11:04:11 +0800 Subject: [PATCH] Support torch 2.5.0 (#109) --- .github/workflows/run-tests-windows-cpu.yml | 2 +- .github/workflows/run-tests-windows-cuda.yml | 2 +- .github/workflows/ubuntu-cpu-wheels.yml | 2 +- .github/workflows/windows-x64-cpu-wheels.yml | 2 +- scripts/github_actions/build-ubuntu-cpu.sh | 12 ++++++++---- scripts/github_actions/build-ubuntu-cuda.sh | 13 +++++++++---- scripts/github_actions/generate_build_matrix.py | 14 +++++++++++++- scripts/github_actions/install_torch.sh | 17 +++++++++++++++++ 8 files changed, 51 insertions(+), 13 deletions(-) diff --git a/.github/workflows/run-tests-windows-cpu.yml b/.github/workflows/run-tests-windows-cpu.yml index cb3e62e..8d33247 100644 --- a/.github/workflows/run-tests-windows-cpu.yml +++ b/.github/workflows/run-tests-windows-cpu.yml @@ -107,7 +107,7 @@ jobs: python3 -c "import kaldifeat; print(kaldifeat.__version__)" - name: Upload Wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: python-${{ matrix.python-version }}-${{ matrix.os }}-cpu path: dist/*.whl diff --git a/.github/workflows/run-tests-windows-cuda.yml b/.github/workflows/run-tests-windows-cuda.yml index 937a445..9845b56 100644 --- a/.github/workflows/run-tests-windows-cuda.yml +++ b/.github/workflows/run-tests-windows-cuda.yml @@ -159,7 +159,7 @@ jobs: python3 -c "import kaldifeat; print(kaldifeat.__version__)" - name: Upload Wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: python-${{ matrix.python-version }}-${{ matrix.os }}-cuda-${{ matrix.cuda }} path: dist/*.whl diff --git a/.github/workflows/ubuntu-cpu-wheels.yml b/.github/workflows/ubuntu-cpu-wheels.yml index 4159bc6..cf8b072 100644 --- a/.github/workflows/ubuntu-cpu-wheels.yml +++ b/.github/workflows/ubuntu-cpu-wheels.yml @@ -73,7 +73,7 @@ jobs: ls -lh ./wheelhouse/ - name: Upload Wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-ubuntu-latest-cpu path: wheelhouse/*.whl diff --git a/.github/workflows/windows-x64-cpu-wheels.yml b/.github/workflows/windows-x64-cpu-wheels.yml index f9a1a92..cc81d14 100644 --- a/.github/workflows/windows-x64-cpu-wheels.yml +++ b/.github/workflows/windows-x64-cpu-wheels.yml @@ -63,7 +63,7 @@ jobs: ls -lh ./wheelhouse/ - name: Upload Wheel - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-windows-latest-cpu path: wheelhouse/*.whl diff --git a/scripts/github_actions/build-ubuntu-cpu.sh b/scripts/github_actions/build-ubuntu-cpu.sh index 1b07111..a113d28 100755 --- a/scripts/github_actions/build-ubuntu-cpu.sh +++ b/scripts/github_actions/build-ubuntu-cpu.sh @@ -17,11 +17,15 @@ fi yum -y install openssl-devel bzip2-devel libffi-devel xz-devel wget redhat-lsb-core -echo "Installing ${PYTHON_VERSION}.2" +INSTALLED_PYTHON_VERSION=${PYTHON_VERSION}.2 +if [[ $PYTHON_VERSION == "3.13" ]]; then + INSTALLED_PYTHON_VERSION=${PYTHON_VERSION}.0 +fi +echo "Installing $INSTALLED_PYTHON_VERSION" -curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}.2/Python-${PYTHON_VERSION}.2.tgz -tar xf Python-${PYTHON_VERSION}.2.tgz -pushd Python-${PYTHON_VERSION}.2 +curl -O https://www.python.org/ftp/python/$INSTALLED_PYTHON_VERSION/Python-$INSTALLED_PYTHON_VERSION.tgz +tar xf Python-$INSTALLED_PYTHON_VERSION.tgz +pushd Python-$INSTALLED_PYTHON_VERSION PYTHON_INSTALL_DIR=$PWD/py-${PYTHON_VERSION} diff --git a/scripts/github_actions/build-ubuntu-cuda.sh b/scripts/github_actions/build-ubuntu-cuda.sh index 19e7e6c..2cb6965 100755 --- a/scripts/github_actions/build-ubuntu-cuda.sh +++ b/scripts/github_actions/build-ubuntu-cuda.sh @@ -31,10 +31,15 @@ fi yum -y install openssl-devel bzip2-devel libffi-devel xz-devel wget redhat-lsb-core -echo "Installing ${PYTHON_VERSION}.2" -curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}.2/Python-${PYTHON_VERSION}.2.tgz -tar xf Python-${PYTHON_VERSION}.2.tgz -pushd Python-${PYTHON_VERSION}.2 +INSTALLED_PYTHON_VERSION=${PYTHON_VERSION}.2 +if [[ $PYTHON_VERSION == "3.13" ]]; then + INSTALLED_PYTHON_VERSION=${PYTHON_VERSION}.0 +fi +echo "Installing $INSTALLED_PYTHON_VERSION" + +curl -O https://www.python.org/ftp/python/$INSTALLED_PYTHON_VERSION/Python-$INSTALLED_PYTHON_VERSION.tgz +tar xf Python-$INSTALLED_PYTHON_VERSION.tgz +pushd Python-$INSTALLED_PYTHON_VERSION PYTHON_INSTALL_DIR=$PWD/py-${PYTHON_VERSION} diff --git a/scripts/github_actions/generate_build_matrix.py b/scripts/github_actions/generate_build_matrix.py index a0a9cb4..bc6eb59 100755 --- a/scripts/github_actions/generate_build_matrix.py +++ b/scripts/github_actions/generate_build_matrix.py @@ -259,13 +259,25 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_ else ["11.8.0", "12.1.0", "12.4.0"] ), }, + "2.5.0": { + # Only Linux supports python 3.13 + "python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"], + "cuda": ( + ["11.8", "12.1", "12.4"] # default 12.4 + if not for_windows + else ["11.8.0", "12.1.0", "12.4.0"] + ), + }, # https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts } if test_only_latest_torch: - latest = "2.4.1" + latest = "2.5.0" matrix = {latest: matrix[latest]} if for_windows or for_macos: + if "2.5.0" in matrix: + matrix["2.5.0"]["python-version"].remove("3.13") + if "1.13.0" in matrix: matrix["1.13.0"]["python-version"].remove("3.11") diff --git a/scripts/github_actions/install_torch.sh b/scripts/github_actions/install_torch.sh index 84e9edd..4d06b90 100755 --- a/scripts/github_actions/install_torch.sh +++ b/scripts/github_actions/install_torch.sh @@ -230,6 +230,23 @@ case ${torch} in ;; esac ;; + 2.5.*) + case ${cuda} in + 11.8) + package="torch==${torch}+cu118" + # https://download.pytorch.org/whl/nightly/torch/ + url=https://download.pytorch.org/whl/torch/ + ;; + 12.1) + package="torch==${torch}+cu121" + url=https://download.pytorch.org/whl/torch/ + ;; + 12.4) + package="torch==${torch}+cu124" + url=https://download.pytorch.org/whl/torch/ + ;; + esac + ;; *) echo "Unsupported PyTorch version: ${torch}" exit 1