Skip to content

Studio: torch 2.13 for new Linux aarch64 cu130 Python 3.13 installs, existing installs keep their torch - #13380

Merged
danielhanchen merged 3 commits into
mainfrom
linux-aarch64-cu130-route
Oct 12, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
linux-aarch64-cu130-route

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

New Studio installs on Linux aarch64 (Grace / GH200 / GB200, DGX Spark) with an NVIDIA driver on the cu130 route and Python 3.13 now get torch 2.13, the same route #12150 added for x86_64. That is the torch the linux_aarch64 flash-attn 2.8.4, causal-conv1d 1.7.0 and mamba-ssm 2.3.2.post1 wheels now on prebuilt-wheels-cu13 are built for (#13261, resolved by #13262).

Today aarch64 stays on the torch 2.11 default and loads upstream's torch 2.10 wheels through the reuse window (flash-attn 2.8.1, causal-conv1d 1.6.1, mamba-ssm 2.3.x), which still work. This puts aarch64 on the same torch and the same kernel builds as x86_64 instead of a separate, older set.

What changes

  • install.sh _cu130_torch213_platform accepts aarch64 / arm64 as well as x86_64 / amd64. Everything else about the route is unchanged: cu130 index, Linux or WSL, a CPython 3.13 venv, the --package unsloth gate, and the PyPI check that the newest unsloth admits torch 2.13.

  • install_python_stack.py applies the same machine set in _is_cu130_route_machine (was _is_native_x86_64), so studio update and the repair paths keep a resident aarch64 2.13 / 2.14 instead of moving it back under the <2.12 default. Windows is untouched: Windows x64 only, and an emulated x64 interpreter on Windows on ARM stays excluded.

  • The new-install choice (on both architectures) also needs glibc 2.35 or newer, the floor the kernel wheels are built and checked against, and a GIL-enabled interpreter, since torch 2.13 has no cp313t wheel. Below that a fresh install stays on the default range. Neither check narrows the preservation window.

  • On aarch64 a repair keeps only a resident 2.10 or newer: the cu130 index has aarch64 torch 2.9 but no torchvision 0.24 / torchaudio 2.9 for it.

Existing installs keep the torch they have, exactly as on x86_64; UNSLOTH_TORCH_UPGRADE=1 opts in.

Tests

  • tests/sh/test_cu130_torch213_route.sh: Linux aarch64 cu130 py3.13 takes the route, 32-bit ARM does not; glibc 2.28 / 2.31 / 2.34 and a free-threaded 3.13 do not take it on either architecture but keep the preservation window (104 checks).
  • studio/backend/tests/test_cu130_repair_torch_specs.py: a resident release is kept on Linux aarch64 as on x86_64 and Windows x64; armv7l and macOS arm64 stay on the default range; aarch64 torch 2.9 repairs to the default range while x86_64 keeps it.

ubuntu-24.04-arm install, no GPU, cu130 forced

main this branch
fresh install.sh torch 2.11.0+cu130, flash-attn 2.8.1 (upstream torch 2.10 wheel), imports torch 2.13.0+cu130, flash-attn 2.8.4 from prebuilt-wheels-cu13, imports
install-kernels causal_conv1d causal-conv1d 1.6.1 (upstream torch 2.10 wheel), imports causal-conv1d 1.7.0 from prebuilt-wheels-cu13, imports
re-run over that install existing install has torch 2.13.0+cu130 -- keeping it, torch unchanged

Not covered

  • No aarch64 GPU in CI: the install route and the kernel wheels are proven to resolve, install and import, not to run kernels.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 12, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cfbf277d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

machine = platform.machine().lower()
if sys.platform.startswith("linux"):
return True
return machine in ("x86_64", "amd64", "aarch64", "arm64")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exclude ARM torch 2.9 from the preservation route

On a Linux aarch64 Python 3.13 environment with resident torch 2.9, this newly enables _cuda_repair_torch_specs, which returns torchaudio==2.9.*; both CUDA repair call sites install the complete trio, but the cu130 index publishes torch 2.9 for aarch64 and no matching torchaudio 2.9 aarch64 wheel (torch index, torchaudio index). Consequently, a repair that previously used the default range now becomes unresolvable, so the ARM route needs an architecture-aware lower bound or companion-package handling.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 22a760b. The cu130 index has aarch64 torch 2.9 but no torchvision 0.24 / torchaudio 2.9 for it, so on Linux aarch64 the repair only keeps a resident 2.10 or newer; 2.9 there falls back to the default range as before. x86_64 still keeps 2.9. Tests cover both.

Comment thread install.sh Outdated
Comment on lines +6149 to +6150
# aarch64 too: prebuilt-wheels-cu13 carries linux_aarch64 builds (Grace, GB10), and upstream's stop at torch 2.10.
case "$_ARCH" in x86_64|amd64|aarch64|arm64) ;; *) echo "no"; return ;; esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Publish ARM kernel assets before selecting torch 2.13

For every fresh aarch64 cu130 install this branch now selects torch 2.13 on the premise that the custom ARM kernels exist, but the referenced release currently describes only Linux x86_64 builds and exposes no linux_aarch64 assets (prebuilt-wheels-cu13 release); the workflow also keeps ARM opt-in rather than producing it in a normal dispatch. Setup therefore skips the missing flash-attn wheel, and SSM models fall through to source packages whose torch-2.13 C++20 patch exists only in the wheel-building workflow, making those models fail to initialize. Publish the ARM assets atomically with this route or keep the route closed until their URLs are available.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release already carries all six linux_aarch64 wheels (flash_attn 2.8.4, causal_conv1d 1.7.0, mamba_ssm 2.3.2.post1 for torch 2.13 and 2.14, cp313), each with a Sigstore bundle and a SHA256SUMS entry, and the notes list a Linux aarch64 section. They were published before this PR was opened; ARM being opt-in in the workflow only affects future dispatches. A fresh aarch64 install on this branch was run end to end and resolves torch 2.13 plus the release flash-attn and causal-conv1d, both importing.

Comment thread install.sh
case "$OS" in linux|wsl) ;; *) echo "no"; return ;; esac
case "$_ARCH" in x86_64|amd64) ;; *) echo "no"; return ;; esac
# aarch64 too: prebuilt-wheels-cu13 carries linux_aarch64 builds (Grace, GB10), and upstream's stop at torch 2.10.
case "$_ARCH" in x86_64|amd64|aarch64|arm64) ;; *) echo "no"; return ;; esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate the ARM torch 2.13 route on glibc 2.35

On supported aarch64 hosts with glibc 2.28–2.34, this enables torch 2.13 even though the linux_aarch64 kernel wheels are built on Ubuntu 22.04 with a documented practical glibc 2.35 floor (.github/scripts/prebuilt_wheels.py:84-89) and are tagged generically enough for pip to accept them. Their import verification then rejects them; for a Mamba model the fallback source build lacks the workflow-only C++20 patch required by torch 2.13 and ensure_ssm_runtime raises, whereas the former torch 2.11 route could build that source. Either retain the old route below glibc 2.35 or publish wheels carrying a compatible manylinux floor.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 22a760b. The new-install choice now also needs glibc 2.35 or newer (read the same way as the uv installer check; musl or an unreadable libc answers no), on x86_64 and aarch64 alike since both builds share that floor. Below it a fresh install stays on the default range. The preservation window is unchanged, so an existing 2.13/2.14 is still kept.

Comment thread install.sh
case "$OS" in linux|wsl) ;; *) echo "no"; return ;; esac
case "$_ARCH" in x86_64|amd64) ;; *) echo "no"; return ;; esac
# aarch64 too: prebuilt-wheels-cu13 carries linux_aarch64 builds (Grace, GB10), and upstream's stop at torch 2.10.
case "$_ARCH" in x86_64|amd64|aarch64|arm64) ;; *) echo "no"; return ;; esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exclude free-threaded Python 3.13 from the ARM route

When --python points at a free-threaded aarch64 Python 3.13 interpreter, the new ARM branch accepts it because the following probe checks only sys.version_info, then requests torch 2.13; the cu130 index has cp313 aarch64 wheels but no cp313t build for torch 2.13 (official torch index), so a fresh install fails resolution. The repository's ARM kernel resolver likewise explicitly supports only GIL-enabled cp313, so this route should also inspect Py_GIL_DISABLED before opting in.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 22a760b. The new-install choice now probes Py_GIL_DISABLED and requires a GIL-enabled interpreter; torch 2.13 has no cp313t wheel on any platform, so a free-threaded 3.13 stays on the default range.

…pairs keep only 2.10+

New installs on a host whose glibc is older than the kernel wheels' floor,
or on a free-threaded interpreter (no cp313t torch 2.13), stay on the
default range. Existing installs keep their release as before. A repair on
aarch64 no longer pins a resident torch 2.9, which has no matching
torchvision / torchaudio on the cu130 index.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 22a760b928

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 55ff88a into main Oct 12, 2026
@danielhanchen
danielhanchen deleted the linux-aarch64-cu130-route branch October 12, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant