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 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/64.added b/changelog.d/64.added new file mode 100644 index 0000000..a15a9ae --- /dev/null +++ b/changelog.d/64.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"