From 247aeb7376bc4fe9f1f4caabdc0084c2acdd96c3 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Wed, 5 Aug 2026 11:36:34 -0700 Subject: [PATCH 1/5] build: support PyTorch 2.12 and 2.13 Add torch_2_12/torch_2_13 dependency groups, raise the project's torch ceiling to 2.13.0, and move the linux CUDA wheel index from cu128 (tops out at torch 2.11.0) to cu129, which covers the full supported range (2.8.0-2.13.0). coreai-torch's only PyPI release (0.4.1) still caps torch<=2.11.0, but that ceiling was already removed on its main branch (apple/coreai-torch#38, #39) two weeks after that release; pin to that commit via a git source until a new release picks it up. --- Makefile | 2 +- changelog.d/182124467.added | 1 + pyproject.toml | 33 ++++++++++++++++++++++++++------- scripts/make/setup_env.sh | 5 +++-- 4 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 changelog.d/182124467.added diff --git a/Makefile b/Makefile index 370fe9c..fa37879 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ VENV_TUTORIAL ?= .venv-tutorial # The torch_2_* groups (pyproject.toml [dependency-groups]) currently at # each end of the supported range. Bump these two lines — nothing else — # when the project's torch version bounds change. -HIGHEST_TORCH_GROUP := torch_2_11 +HIGHEST_TORCH_GROUP := torch_2_13 LOWEST_TORCH_GROUP := torch_2_8 # Torch dependency group (pyproject.toml [dependency-groups]) that every diff --git a/changelog.d/182124467.added b/changelog.d/182124467.added new file mode 100644 index 0000000..a15a9ae --- /dev/null +++ b/changelog.d/182124467.added @@ -0,0 +1 @@ +Added support for PyTorch 2.12 and 2.13. diff --git a/pyproject.toml b/pyproject.toml index c9eea89..4bba246 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,8 +46,9 @@ dependencies = [ # based on other package versions. We can either 1) add a stricter check to require the newer torchao # version for everyone, or 2) add a runtime check in src/coreai_opt/init.py to ensure torchao # version >= 0.15.0 for torch version >= 2.9.0. Opting option 1. - # These torch versions must be in bounds of torch_2_8, torch_2_9, torch_2_10, and torch_2_11 - "torch>=2.8.0,<=2.11.0", + # These torch versions must be in bounds of torch_2_8, torch_2_9, torch_2_10, torch_2_11, + # torch_2_12, and torch_2_13 + "torch>=2.8.0,<=2.13.0", "torchao>=0.15.0,<=0.17.0", "tqdm>=4.65", ] @@ -56,7 +57,10 @@ name = "Apple Core AI Optimization Team" [project.optional-dependencies] coreai = [ "coreai-core==1.0.0b2", - "coreai-torch==0.4.1", + # TODO: Pin back to a released version once coreai-torch cuts a release past + # 0.4.1 (2026-07-01). main already dropped the torch<=2.13.0 ceiling + # (apple/coreai-torch#38, #39) that blocks torch_2_12/torch_2_13 below. + "coreai-torch", "scikit-learn>=1.7.2", ] coreml = [ @@ -141,6 +145,16 @@ torch_2_11 = [ "torchao==0.17.0", "torchvision==0.26.0", ] +torch_2_12 = [ + "torch==2.12.1", + "torchao==0.17.0", + "torchvision==0.27.1", +] +torch_2_13 = [ + "torch==2.13.0", + "torchao==0.17.0", + "torchvision==0.28.0", +] torch_2_8 = [ "torch==2.8.0", "torchao==0.15.0", @@ -154,7 +168,7 @@ torch_2_9 = [ # Since torch and torchao are project dependencies, we need to include torchvision in dev # This allows standard `make test` to find torchvision torchvision = [ - "torchvision>=0.23.0,<=0.26.0", + "torchvision>=0.23.0,<=0.28.0", ] tutorial = [ "ipykernel>=7.2.0", @@ -182,7 +196,7 @@ find.where = [ "src" ] default-groups = [ "dev", "coreai", "coreml" ] index = [ { explicit = true, name = "pytorch-cpu", url = "https://download.pytorch.org/whl/cpu" }, - { explicit = true, name = "pytorch-cu128", url = "https://download.pytorch.org/whl/cu128" }, + { explicit = true, name = "pytorch-cu129", url = "https://download.pytorch.org/whl/cu129" }, ] # Only resolve for platforms where all dependencies (including coreai) exist environments = [ @@ -201,16 +215,21 @@ conflicts = [ { group = "torch_2_9" }, { group = "torch_2_10" }, { group = "torch_2_11" }, + { group = "torch_2_12" }, + { group = "torch_2_13" }, ], ] [tool.uv.sources] +# TODO: Remove once coreai-torch cuts a release past 0.4.1 that includes the +# torch<=2.13.0 ceiling removal from apple/coreai-torch#38/#39. +coreai-torch = { git = "https://github.com/apple/coreai-torch", rev = "c89f6a44713249a12a84beec9f3e0cf2206ecc38" } torch = [ { index = "pytorch-cpu", marker = "sys_platform != 'linux'" }, - { index = "pytorch-cu128", marker = "sys_platform == 'linux'" }, + { index = "pytorch-cu129", marker = "sys_platform == 'linux'" }, ] torchvision = [ { index = "pytorch-cpu", marker = "sys_platform != 'linux'" }, - { index = "pytorch-cu128", marker = "sys_platform == 'linux'" }, + { index = "pytorch-cu129", marker = "sys_platform == 'linux'" }, ] [tool.ruff] diff --git a/scripts/make/setup_env.sh b/scripts/make/setup_env.sh index 77ebeba..40e651c 100755 --- a/scripts/make/setup_env.sh +++ b/scripts/make/setup_env.sh @@ -109,7 +109,8 @@ ENSURE_MODE=false # Groups excluded from --all-groups due to mutual conflicts in pyproject.toml. # tamm-export is omitted because it's opt-in only (never in default-groups or --all-groups). -CONFLICTING_GROUPS=("torch_2_8" "torch_2_9" "torch_2_10" "torch_2_11") +CONFLICTING_GROUPS=("torch_2_8" "torch_2_9" "torch_2_10" + "torch_2_11" "torch_2_12" "torch_2_13") show_help() { echo "Usage: $0 [OPTIONS]" @@ -136,7 +137,7 @@ show_help() { echo " $0 --python-version 3.11 # Setup with dev group only" echo " $0 --python-version 3.11 --with-docs # Setup with dev and docs groups" echo " $0 --python-version 3.11 --all-groups # Setup with all non-conflicting groups" - echo " TORCH_GROUP=torch_2_11 $0 --python-version 3.11 --all-groups # Setup with all groups and torch 2.11" + echo " TORCH_GROUP=torch_2_13 $0 --python-version 3.11 --all-groups # Setup with all groups and torch 2.13" echo " TORCH_GROUP=torch_2_8 $0 --python-version 3.11 --all-groups # Setup with all groups and torch 2.8" echo " $0 --python-version 3.11 --venv .venv-exp # Setup with custom venv name" echo " $0 --python-version 3.11 --with-docs --venv .venv-exp # Setup with docs group and custom venv name" From c4beb616c330ed23f2879f7388c716e318bf6815 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Wed, 5 Aug 2026 11:37:07 -0700 Subject: [PATCH 2/5] ci: add torch 2.12 and 2.13 smoke test legs --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0c6542..b8c0f9d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,6 +55,10 @@ jobs: torch_version: "2.10" - torch_group: torch_2_11 torch_version: "2.11" + - torch_group: torch_2_12 + torch_version: "2.12" + - torch_group: torch_2_13 + torch_version: "2.13" steps: - name: Check out repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 From 1d895833e65075cdd28dac4444e949b322966326 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Wed, 5 Aug 2026 11:37:26 -0700 Subject: [PATCH 3/5] ci: TEMP - trigger on u/** pushes (REVERT BEFORE UPSTREAM PR) Lets CI run on pushes to this fork's working branch without opening a PR first, so the new torch 2.12/2.13 legs can be checked before opening the real PR into apple/coreai-optimization. Must not reach upstream. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b8c0f9d..817b418 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: pull_request: branches: [main] push: - branches: [main] + branches: [main, 'u/**'] permissions: contents: read From e67b09a6092198bc7a51a5e440cc0e2b80e77d45 Mon Sep 17 00:00:00 2001 From: Guru Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Wed, 5 Aug 2026 12:53:40 -0700 Subject: [PATCH 4/5] Revert "ci: TEMP - trigger on u/** pushes (REVERT BEFORE UPSTREAM PR)" This reverts commit 1d895833e65075cdd28dac4444e949b322966326. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 817b418..b8c0f9d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: pull_request: branches: [main] push: - branches: [main, 'u/**'] + branches: [main] permissions: contents: read From d8bd5e86db0c5a37fc9346d34cd28408180384b1 Mon Sep 17 00:00:00 2001 From: Gururaj Deshpande <66385690+guru-desh@users.noreply.github.com> Date: Thu, 6 Aug 2026 10:52:32 -0700 Subject: [PATCH 5/5] Rename changelog entry to be PR number --- changelog.d/{182124467.added => 64.added} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{182124467.added => 64.added} (100%) diff --git a/changelog.d/182124467.added b/changelog.d/64.added similarity index 100% rename from changelog.d/182124467.added rename to changelog.d/64.added