Fix building wheels for torch 2.2.0.

See also https://github.com/pytorch/pytorch/issues/120020
This commit is contained in:
Fangjun Kuang 2024-02-18 19:39:41 +08:00
parent 2e042b356e
commit 9c1989b96e
2 changed files with 23 additions and 0 deletions

View File

@ -28,6 +28,9 @@ jobs:
# outputting for debugging purposes # outputting for debugging purposes
python ./scripts/github_actions/generate_build_matrix.py python ./scripts/github_actions/generate_build_matrix.py
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py) MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py)
# python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
echo "::set-output name=matrix::${MATRIX}" echo "::set-output name=matrix::${MATRIX}"
build-manylinux-wheels: build-manylinux-wheels:

View File

@ -5,6 +5,18 @@ import argparse
import json import json
def version_ge(a, b):
a_major, a_minor = list(map(int, a.split(".")))[:2]
b_major, b_minor = list(map(int, b.split(".")))[:2]
if a_major > b_major:
return True
if a_major == b_major and a_minor >= b_minor:
return True
return False
def get_args(): def get_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
@ -216,6 +228,14 @@ def generate_build_matrix(enable_cuda, for_windows, for_macos, test_only_latest_
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})
elif version_ge(torch, "2.2.0"):
ans.append(
{
"torch": torch,
"python-version": p,
"image": "pytorch/manylinux-builder:cpu-2.2",
}
)
else: else:
ans.append( ans.append(
{ {