support torch 2.7.0 (#118)

This commit is contained in:
Fangjun Kuang 2025-06-05 10:47:36 +08:00 committed by GitHub
parent 0ecdee6e88
commit 6edd6a8370
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 62 additions and 24 deletions

View File

@ -3,7 +3,8 @@ name: build-wheels-cpu-macos
on: on:
push: push:
branches: branches:
- fix-wheel-2 - wheel
# - torch-2.7.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:

View File

@ -3,8 +3,8 @@ name: build-wheels-cpu-arm64-ubuntu
on: on:
push: push:
branches: branches:
# - wheel - wheel
- fix-cuda-12.6 # - torch-2.7.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -27,11 +27,11 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py --for-arm64 # python ./scripts/github_actions/generate_build_matrix.py --for-arm64
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-arm64) # MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-arm64)
# python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch --for-arm64 python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch --for-arm64
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch --for-arm64) MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch --for-arm64)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels: build-manylinux-wheels:

View File

@ -3,8 +3,8 @@ name: build-wheels-cpu-ubuntu
on: on:
push: push:
branches: branches:
# - fix-cuda-12.6
- wheel - wheel
# - torch-2.7.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:

View File

@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- wheel - wheel
- torch-2.7.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -26,11 +27,11 @@ jobs:
id: set-matrix id: set-matrix
run: | run: |
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py --enable-cuda # python ./scripts/github_actions/generate_build_matrix.py --enable-cuda
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda) # MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda)
# python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch) MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels: build-manylinux-wheels:

View File

@ -3,7 +3,8 @@ name: build-wheels-cpu-win64
on: on:
push: push:
branches: branches:
- fix-wheel-2 - wheel
# - torch-2.7.0
tags: tags:
- '*' - '*'
workflow_dispatch: workflow_dispatch:
@ -47,15 +48,23 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/ - name: Setup Python
# for a list of versions uses: actions/setup-python@v5
- name: Build wheels with:
uses: pypa/cibuildwheel@v2.22.0 python-version: ${{ matrix.python-version }}
env:
CIBW_BEFORE_BUILD: pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch_stable.html cmake numpy || pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch/ cmake numpy - name: Install dependencies
CIBW_BUILD: ${{ matrix.python-version }}-win_amd64 shell: bash
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "" run: |
CIBW_BUILD_VERBOSITY: 3 pip install -q torch==${{ matrix.torch}} cmake numpy wheel>=0.40.0 twine setuptools
pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch_stable.html cmake numpy || pip install torch==${{ matrix.torch}}+cpu -f https://download.pytorch.org/whl/torch/ cmake numpy
- name: Build wheel
shell: bash
run: |
python3 setup.py bdist_wheel
mkdir wheelhouse
cp -v dist/* wheelhouse
- name: Display wheels - name: Display wheels
shell: bash shell: bash

View File

@ -1,4 +1,7 @@
# Copyright (c) 2021 Xiaomi Corporation (author: Fangjun Kuang) # Copyright (c) 2021 Xiaomi Corporation (author: Fangjun Kuang)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
endif()
cmake_minimum_required(VERSION 3.8 FATAL_ERROR) cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

View File

@ -303,10 +303,18 @@ def generate_build_matrix(
else ["11.8.0", "12.4.0", "12.6.0"] else ["11.8.0", "12.4.0", "12.6.0"]
), ),
}, },
"2.7.0": {
"python-version": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"cuda": (
["11.8", "12.6", "12.8"]
if not for_windows
else ["11.8.0", "12.6.2", "12.8.1"]
),
},
# https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts # https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts
} }
if test_only_latest_torch: if test_only_latest_torch:
latest = "2.6.0" latest = "2.7.0"
matrix = {latest: matrix[latest]} matrix = {latest: matrix[latest]}
if for_windows or for_macos: if for_windows or for_macos:
@ -377,7 +385,6 @@ def generate_build_matrix(
continue continue
if for_windows: if for_windows:
p = "cp" + "".join(p.split("."))
ans.append({"torch": torch, "python-version": p}) ans.append({"torch": torch, "python-version": p})
elif for_macos: elif for_macos:
ans.append({"torch": torch, "python-version": p}) ans.append({"torch": torch, "python-version": p})

View File

@ -264,6 +264,23 @@ case ${torch} in
;; ;;
esac esac
;; ;;
2.7.*)
case ${cuda} in
11.8)
package="torch==${torch}+cu118"
# https://download.pytorch.org/whl/nightly/torch/
url=https://download.pytorch.org/whl/torch/
;;
12.6)
package="torch==${torch}+cu126"
url=https://download.pytorch.org/whl/torch/
;;
12.8)
package="torch==${torch}+cu128"
url=https://download.pytorch.org/whl/torch/
;;
esac
;;
*) *)
echo "Unsupported PyTorch version: ${torch}" echo "Unsupported PyTorch version: ${torch}"
exit 1 exit 1