Studio: install torch 2.11 on all modern CUDA (cu126/cu128/cu130) - #6982
ThomasEricB wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a PyTorch version constraint override for CUDA 13 (cu130 / Blackwell) in install.sh to support up to torch < 2.12.0, along with a corresponding test in test_torch_constraint.sh. Feedback suggests tightening the cu130 constraint to torch>=2.11.0,<2.12.0 instead of torch>=2.4 to prevent package managers from resolving to torch==2.10.0, which has known compatibility issues with torchao kernels on CUDA 13. The associated test should also be updated to match this tightened constraint.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Reviewed this. The One real issue: the new structural test's regex was over-escaped. In a single-quoted ERE, Rest of the constraint suite is green. Two notes, not blockers:
|
I am afraid of pushing anything Windows side without at least verifying it runs there.
While it's great that it runs, but we don't know if there is a bump ahead in the road yet, so I can't in good consciousness allow this PR to be merged without at least me actually running Unsloth Studio and generating lots and lots of activity in it. Will report back when satisfied. |
…thai#6982 The cu126/cu128/cu130 indexes all ship torch 2.11.0 wheels, so add cu128 and cu126 to the TORCH_CONSTRAINT override next to cu130. Older CUDA (cu124/cu118), other ROCm tags, CPU and macOS keep the <2.11.0 default (no torch 2.11 wheels there). Extend the structural test to assert all three overrides.
|
Broadened this to all modern CUDA (cu126/cu128/cu130) in 93d4e1d, not just cu130. All three indexes ship torch 2.11.0 wheels, so one per-index override block handles them. The default Also verified on a B200 (sm_100) to complement your RTX 5090 (sm_120) run: a fresh torch 2.11.0+cu130 venv with the wheels the installer selects has flash-attn FA2 matching SDPA ( Updated the structural test to assert all three overrides and refreshed the title/description to match. I had opened #6997 with the same change before deciding to fold it in here, so I am closing that in favor of this. |
|
Windows is untouched here. This only adds per-index overrides in the Linux On the B200: 93d4e1d adds that sm_100 pass. Fresh torch 2.11.0+cu130 venv with the exact wheels the installer selects, flash-attn FA2 matches SDPA ( |
|
I reviewed the latest 3 commits on my end and it works perfectly! |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Folded in a readiness canary for the torch 2.12 blocker. Context: on a B200 (sm_100) I checked flash-attn, causal-conv1d and mamba on torch 2.12.0+cu130. causal-conv1d ( To catch when that blocker lifts, |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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 Commit 8413342 fixes the 4 out of 5 things the bot above and in the disposable CI run at danielhanchen#315 flagged.
|
|
Thanks for grabbing these. Your canary workflow fix is exactly right: adding On the 5th (worker.py |
I can make a new PR later for that one but I don't want to step too much into something I have no clue about actually (I am already mostly out of my depth). |
|
Folded the worker.py fix into this branch in cabdb49 rather than opening a separate PR. |
|
@danielhanchen I think this is read to merge? |
|
Outdated, ROCM sucks on the Steam Deck LOL |
Continuation of unslothai#6982, which added per-index TORCH_CONSTRAINT overrides for rocm7.2 and the modern CUDA indexes and explicitly left CPU as a follow-up wanting its own smoke pass. This is that follow-up. The cpu index ships the whole 2.11 trio -- torch 2.11.0+cpu, torchvision 0.26.0+cpu, torchaudio 2.11.0+cpu -- for cp312 and cp313, so a Linux CPU install currently lands on the 2.10 family for no reason other than the default constraint never having been revisited. case "$_torch_index_leaf" in cpu) if [ "$OS" != "macos" ]; then TORCH_CONSTRAINT="torch>=2.11.0,<2.12.0" TORCHVISION_CONSTRAINT="torchvision>=0.26.0,<0.27.0" TORCHAUDIO_CONSTRAINT="torchaudio>=2.11.0,<2.12.0" fi ;; esac The companions move with torch, matching how the rocm7.2 arm pins its trio. The existing bounded companion defaults already prevent the bare-companion mismatch described above them (verified: with the current bounds the cpu leaf resolves a consistent torch/torchaudio/torchvision 2.10/2.10/0.25 set; only bare companion names reproduce torch 2.10.0+cpu with torchaudio 2.11.0+cpu), so this is not a fix for that -- it keeps the same property one version up. No glibc floor moves: the 2.11 cpu wheels use the same manylinux_2_28 platform tag as the 2.10 cpu wheels on both x86_64 and aarch64, so no older distro is stranded. macOS is deliberately excluded. get_torch_index_url returns $_base/cpu on Darwin, so macOS shares this leaf, and its arm64 wheels have had no smoke pass; it keeps the default window and the Python 3.13 >=2.6 floor set earlier. install.ps1 is untouched, so Windows is unaffected. The default torch>=2.4,<2.11.0 also stays put for every other leaf, keeping the "hardcoded torch>=2.4 appears exactly once" guard valid. Verification: uv resolves the intended trio from the cpu index on cp312, cp313 and aarch64 (torch 2.11.0+cpu / torchvision 0.26.0+cpu / torchaudio 2.11.0+cpu); unsloth 2026.8.10's torch<2.12.0,>=2.4.0 admits 2.11. Full Linux x86_64 CPU stack smoke pass on that trio with unsloth 2026.8.10 and torchao 0.18.0 -- torch.autograd.gradcheck passes in float64, a 60-step SGD run converges identically to the pre-bump stack (0.9710 -> 0.1148), torchao int8-weight-only quantize_() plus forward runs, and Unsloth Studio starts and serves. tests/sh/test_torch_constraint.sh is 51/51, extended with linux/wsl/macos cpu cases and a mirror whose base path contains cpu but whose leaf does not. The real case block was also extracted from install.sh and exercised across {linux,wsl,macos} x {cpu,rocm7.2,cu128,xpu} to confirm the other leaves are unchanged on every OS. bash -n install.sh clean.
Continuation of unslothai#6982, which added per-index TORCH_CONSTRAINT overrides for rocm7.2 and the modern CUDA indexes and explicitly left CPU as a follow-up wanting its own smoke pass. This is that follow-up. The cpu index ships the whole 2.11 trio -- torch 2.11.0+cpu, torchvision 0.26.0+cpu, torchaudio 2.11.0+cpu -- for cp312 and cp313, so a Linux CPU install currently lands on the 2.10 family for no reason other than the default constraint never having been revisited. case "$_torch_index_leaf" in cpu) if [ "$OS" != "macos" ]; then TORCH_CONSTRAINT="torch>=2.11.0,<2.12.0" TORCHVISION_CONSTRAINT="torchvision>=0.26.0,<0.27.0" TORCHAUDIO_CONSTRAINT="torchaudio>=2.11.0,<2.12.0" fi ;; esac The companions move with torch, matching how the rocm7.2 arm pins its trio. The existing bounded companion defaults already prevent the bare-companion mismatch described above them (verified: with the current bounds the cpu leaf resolves a consistent torch/torchaudio/torchvision 2.10/2.10/0.25 set; only bare companion names reproduce torch 2.10.0+cpu with torchaudio 2.11.0+cpu), so this is not a fix for that -- it keeps the same property one version up. No glibc floor moves: the 2.11 cpu wheels use the same manylinux_2_28 platform tag as the 2.10 cpu wheels on both x86_64 and aarch64, so no older distro is stranded. macOS is deliberately excluded. get_torch_index_url returns $_base/cpu on Darwin, so macOS shares this leaf, and its arm64 wheels have had no smoke pass; it keeps the default window and the Python 3.13 >=2.6 floor set earlier. install.ps1 is untouched, so Windows is unaffected. The default torch>=2.4,<2.11.0 also stays put for every other leaf, keeping the "hardcoded torch>=2.4 appears exactly once" guard valid. Verification: uv resolves the intended trio from the cpu index on cp312, cp313 and aarch64 (torch 2.11.0+cpu / torchvision 0.26.0+cpu / torchaudio 2.11.0+cpu); unsloth 2026.8.10's torch<2.12.0,>=2.4.0 admits 2.11. Full Linux x86_64 CPU stack smoke pass on that trio with unsloth 2026.8.10 and torchao 0.18.0 -- torch.autograd.gradcheck passes in float64, a 60-step SGD run converges identically to the pre-bump stack (0.9710 -> 0.1148), torchao int8-weight-only quantize_() plus forward runs, and Unsloth Studio starts and serves. tests/sh/test_torch_constraint.sh is 51/51, extended with linux/wsl/macos cpu cases and a mirror whose base path contains cpu but whose leaf does not. The real case block was also extracted from install.sh and exercised across {linux,wsl,macos} x {cpu,rocm7.2,cu128,xpu} to confirm the other leaves are unchanged on every OS. bash -n install.sh clean.
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@oobabooga Just updated the branch to be with main. Net diff vs main is exactly the 4 intended files: orchestrator.py, routes/settings.py, test_orchestrator_unload_cancel.py, test_audio_tts_cancellation.py. |
|
Thanks. Added ba2cc23: a test for the Diff vs main is now those four files plus the new test. |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex approved df36b16, so reviews have converged. Last push was the comment-reduction pass (comment lines on the added hunks 42 -> 17, AST-gated as comment-only). CI has two reds, both pre-existing and not from this PR:
Both exercise Backend suites for the touched code are green here: test_orchestrator_unload_cancel, test_audio_tts_cancellation, test_embedding_model_security_gate, test_orchestrator_idle_subprocess_teardown, test_embedding_model_settings, test_rag_embeddings -- 201 passed, ruff clean. The description still needs rewriting before merge: it describes the torch 2.11 |
for more information, see https://pre-commit.ci
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex approved 738e431, so reviews are converged again on the merged head. The two new commits are a main merge and a pre-commit.ci autofix; no PR code changed, and the 201 backend tests for the touched modules still pass here with ruff clean. Of the four CI reds, two were noise and cleared on re-run:
The remaining two,
Both are source-text contract assertions against files this PR does not touch. I checked out upstream main at 024df09 with none of this PR's changes and got the identical The description still needs rewriting before merge -- it describes the torch 2.11 |
|
Confirmed the unguarded drain is still there in studio/backend/core/inference/orchestrator.py around the share_distributed_object call, and the embedding scan route still 500s on a scan error, so both hunks land on real code. One thing before I review: the description still describes the torch 2.11 install.sh work rather than what the diff now does, so could you update it to match? |
|
Main's install.sh now defaults the torch ceiling to 2.12.0 on every index, including cu126, cu128 and cu130, so the install change is no longer needed, and the branch now only carries orchestrator and test changes unrelated to the title. Sorry for the slow review, and thanks for putting it together. |



Continuation of #6970.
Summary
Install torch 2.11 on all modern CUDA indexes. This adds a per-index
TORCH_CONSTRAINToverride ininstall.shforcu126,cu128, andcu130, mirroring the existingrocm7.2one, so fresh CUDA 12.6+/13 installs land on torch 2.11 where torchao 0.17's cpp extensions load. flash-attn / causal-conv1d / mamba already reuse their torch2.10 wheels on 2.11 (wheel_utils.prebuilt_wheel_torch_mm, from #6970).The default
torch>=2.4,<2.11.0is intentionally left untouched, so older CUDA (cu124/cu118), other ROCm tags, CPU, and macOS stay on the 2.10 family. torch 2.11 publishes no wheels for those indexes, so bumping the default would make old-driver fresh installs resolve a nonexistent wheel and fail. Keeping the default also keeps the "hardcoded torch>=2.4 appears exactly once" test guard valid. GPU-arch support is unchanged:cu1262.11 keeps Maxwell/Pascal/Volta/Turing+, andcu128/cu130are Turing (SM 7.5)+ exactly as their 2.10 counterparts were.Verification
Structural test asserts each cu126/cu128/cu130 override is present;
tests/sh/test_torch_constraint.shis 28/28 andbash -n install.shis clean.tests/python/test_tokenizers_and_torch_constraint.pyandstudio/backend/tests/test_torchao_select.pypass.Stack smoke on both Blackwell tiers under torch 2.11.0+cu130:
max|err| = 8.1e-03, bf16), torchao 0.17.0 int8-weight-onlyLinearruns (cpp path loads), bitsandbytes 0.49.2Linear4bitruns, triton 3.6.0 and xformers 0.0.35 import.Scope / follow-ups
install.ps1) are separate follow-ups; each has torch 2.11 wheels but wants its own smoke pass. Old CUDA (cu124/cu118), non-7.2 ROCm, and macOS x86 stay on 2.10 (no 2.11 wheels).Related: #6961, #6970.
Readiness canary (torch 2.12)
Verified on a B200 (sm_100) that torch 2.12 breaks the accelerator wheel reuse for flash-attn only: torch 2.12 changed the c10 CUDA-check ABI, so every pre-2.12 flash-attn wheel fails to import, while causal-conv1d and mamba still load and pass via their
cu13torch2.10wheels. This is why the ceiling stays<2.12.0.studio/backend/tests/test_flash_attn_torch212_canary.pyplus.github/workflows/flash-attn-torch212-canary.ymlpoll the flash-attn releases weekly and fail once a torch >= 2.12 wheel appears, opening a tracking issue with the steps to raise the ceiling. The live poll is gated behindUNSLOTH_RUN_FLASH_ATTN_CANARYso only the scheduled job runs it; the offline parser tests run in every suite.