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:
push:
branches:
- fix-wheel-2
- wheel
# - torch-2.7.0
tags:
- '*'
workflow_dispatch:

View File

@ -3,8 +3,8 @@ name: build-wheels-cpu-arm64-ubuntu
on:
push:
branches:
# - wheel
- fix-cuda-12.6
- wheel
# - torch-2.7.0
tags:
- '*'
workflow_dispatch:
@ -27,11 +27,11 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
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 --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
# MATRIX=$(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)
echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels:

View File

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

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- wheel
- torch-2.7.0
tags:
- '*'
workflow_dispatch:
@ -26,11 +27,11 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
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
# 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
# MATRIX=$(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)
echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels:

View File

@ -3,7 +3,8 @@ name: build-wheels-cpu-win64
on:
push:
branches:
- fix-wheel-2
- wheel
# - torch-2.7.0
tags:
- '*'
workflow_dispatch:
@ -47,15 +48,23 @@ jobs:
with:
fetch-depth: 0
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
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
CIBW_BUILD: ${{ matrix.python-version }}-win_amd64
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: ""
CIBW_BUILD_VERBOSITY: 3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash
run: |
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
shell: bash

View File

@ -1,4 +1,7 @@
# 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)

View File

@ -303,10 +303,18 @@ def generate_build_matrix(
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
}
if test_only_latest_torch:
latest = "2.6.0"
latest = "2.7.0"
matrix = {latest: matrix[latest]}
if for_windows or for_macos:
@ -377,7 +385,6 @@ def generate_build_matrix(
continue
if for_windows:
p = "cp" + "".join(p.split("."))
ans.append({"torch": torch, "python-version": p})
elif for_macos:
ans.append({"torch": torch, "python-version": p})

View File

@ -264,6 +264,23 @@ case ${torch} in
;;
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}"
exit 1