Repository navigation
Installers: new cu130 homes take torch 2.14 (2.14.1+cu130) instead of 2.13 - #19762
danielhanchen wants to merge 1 commit into
Conversation
New Linux and Windows x64 installs on the cu130 route (driver CUDA 13+, Python 3.13, GIL build, glibc 2.35+) now get torch>=2.14.0,<2.15.0 with torchvision 0.29 from whl/cu130, which resolves 2.14.1+cu130. The PyPI gate asks the released unsloth metadata for 2.14 instead of 2.13. Existing homes keep their resident release exactly as before; UNSLOTH_TORCH_UPGRADE=1 still opts in.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
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". |
|
The macos-26 failure in the cross-platform staging run ( |
…19772) ## Problem On Apple Silicon macOS runners, `studio/backend/tests/test_cu130_repair_torch_specs.py::test_core_update_freezes_only_torch_past_the_released_ceiling[darwin-2.13.0-False]` fails. For example, the macos-26 leg of the cross-platform staging run for #19762: ``` assert mod._TORCH_FREEZE_ACTIVE is pinned E AssertionError: assert True is False ``` The test passes on Linux, which is why the normal CI shards never show it. ## Cause - #18659 made `_FreezeNewTorchForCoreUpdate` keep an Apple Silicon install's torch at any release: `sys.platform == "darwin" and platform.machine() == "arm64"`. - This test fakes `sys.platform` per row but read the real `platform.machine()`. Its darwin row expects no freeze, so the row really means Intel macOS. - On an x64 Linux runner the machine is `x86_64` and the row passes. On an arm64 macOS runner it is `arm64`, the freeze engages, and the row fails. The code is correct, and Apple Silicon's freeze is already covered by `test_macos_core_update_torch_freeze.py`. The test is host-dependent. ## Fix Pin `platform.machine()` to `x86_64` in this test, so every row describes an x64 host and the darwin row is Intel macOS on any runner. No product code changes. ## Verification To reproduce an Apple Silicon host on Linux, a small plugin sets `platform.machine = lambda: "arm64"` before the session: | Arm | Simulated arm64 host | Native x86_64 host | |---|---|---| | main 6a3a230 | `1 failed, 57 passed`: the same `darwin-2.13.0-False` row as the macos-26 job | `58 passed` | | this branch | `58 passed` | `58 passed` | Sabotage: making the freeze apply to every macOS machine (dropping the `platform.machine() == "arm64"` check in `studio/install_python_stack.py`) fails the darwin row on this branch. The row therefore still guards that Intel macOS is not frozen. #19762 edits the same parametrize list. Its own macOS failure is this one, so it will pass once this lands.
Status: closed as no gain for now
Moving new cu130 homes off torch 2.13.0 currently costs more than it returns. The details are below. The rest of this body is the original change and its evidence, kept for when this is revisited.
Studio engine reuse
An opt-in engine reuses Studio's torch only when the torch build matches exactly.
install_plansetssharedonly if_same_build(studio torch, locked torch)holds and every torch runtime package (nvidia-*,cuda-toolkit,triton) fits the lock. Otherwise the engine gets an isolated env with its own torch stack.vllm-linux-cu130-torch213torch==2.13.0vllm-linux-cu130torch==2.11.0sglang-linux-cu130-torch213torch==2.13.0sglang-linux-cu130torch==2.11.0No lock carries a 2.14 build. So 2.13.0 is the only cu130 spec that keeps both engines shared, and every 2.14.x spec isolates both.
New locks would not fix this either. The newest upstream releases pin different 2.14 patches:
torch==2.14.0.torch==2.14.1.Any single 2.14 pick would therefore share with at most one of the two engines. Today, 2.13.0 shares with both.
Cost of isolation
The torch runtime in the vLLM 2.13 lock is about 2.5 GiB of wheels (cp313 manylinux x86_64). It is re-downloaded once per isolated engine env; the uv cache dedupes a second engine on the same torch. The largest pieces:
The unpacked copy in the engine env adds several GB of disk on top.
Benefit of 2.14 for training
Measured: no difference. On a Colab L4, 35 steps, ABBAAB order, 3 runs per arm, unsloth 2026.11.12:
The 2.14-only items in the code are mostly bugs that Unsloth already works around on 2.13:
fix_inductor_reduction_readback_race);attention_dispatch.py);_block_compile.py);_scaled_mmwith fp16 output dequantizes instead (kernels/fp8.py).The items that are really 2.14-only are narrow:
unsloth_zoo/gradient_checkpointing.py): a host-RAM saving on long-context offload._utils.py): an inference path, not training._utils.py): Blackwell only._block_compile.py,_CPP_WRAPPER_MIN_TORCH = "2.14.0"):2.14 also adds hazards that need gates: cuDNN 9.24 NaN dQ for masked head_dim 256 on sm90 / sm100 (
fix_cudnn_sdpa_d256_masked_backward), and the context-parallel efficient backward giving wrong dq / dk in fp16 / bf16.When to revisit
Revisit together with the engine-lock update. vLLM 0.33+ pins 2.14.0 and SGLang 0.5.22+ pins 2.14.1, so that update has to choose which engine keeps sharing. Pin new homes to exactly that torch (for example
torch==2.14.0for vLLM, which is onwhl/cu130). The C++-wrapper release is the other trigger, if it shows a measured win beyond A/A on the default route.Summary
New installs on the cu130 route now get torch 2.14 instead of 2.13. This covers
install.shon Linux / WSL x86_64 and aarch64, andinstall.ps1on Windows x64. The route needs a driver that reports CUDA 13+, Python 3.13, a GIL build, and glibc 2.35+ on Linux.torch>=2.13.0,<2.14.0torch>=2.14.0,<2.15.0torchvision>=0.28.0,<0.29.0torchvision>=0.29.0,<0.30.0whl/cu130(cp313, x86_64 / aarch64 / win_amd64)_pypi_unsloth_admits_torch/Test-PypiUnslothAdmitsTorch)Unchanged:
torch>=2.4,<2.15.0, so a resident 2.13.0 stays 2.13.0.UNSLOTH_TORCH_UPGRADE=1still opts in and now moves to 2.14.<2.12.0window: cu128, cu126, cu124 / cu118, Python 3.12, free-threaded builds, glibc < 2.35, CPU, ROCm, XPU and macOS.studio/setup.ps1needs no change. Its CUDA spec is unbounded, so a run without an installer handoff already resolves the newest release onwhl/cu130, which is 2.14.1.studio/install_python_stack.pyneeds only a comment change. Its cu130 repair already keeps a resident 2.9-2.14. Thestudio updatetorch freeze already covers torch >= 2.13 on Linux and Windows x64.Why 2.14 is safe here
torch<2.15.0, so 2.14.x is inside the release metadata. The gate now checks for exactly that.prebuilt-wheels-cu13already publishes torch 2.14 cells for flash-attn, causal-conv1d and mamba-ssm (cp313, linux_x86_64, linux_aarch64, win_amd64)._UNSLOTH_PREBUILT_TORCH_MMalready lists 2.14.wheel_utils.pyandinstall.ps1. triton-windows already pairs 3.8 with torch 2.14.vLLM / SGLang
No installer route puts vLLM into the Studio venv, so the vLLM
torch==2.14.0exact pin never meets this spec. The opt-in Studio engines (engine_install.py) share Studio's torch only on an exact build match. Today that means vLLM 0.30.0 or SGLang 0.5.20 on torch 2.13.0. A new cu130 home on 2.14.1 therefore gets those engines in their own isolated environment, which is the same path every existing 2.14 home and every cu128 / cu126 home already takes. It works, but it costs one extra torch download. The engine locks are not touched here.Default
_TORCH_CEILING(cu128 / cu126) left at 2.12.0whl/cu128stops at 2.11.0, so raising the ceiling changes nothing there.PINNED_SOURCE_BUILD_MAX_TORCH), and our prebuilt cells are CUDA 13 only. The same ceiling also drives the CPU route and the repair specs.Tests
Extended so that the new spec fails on base and passes on head:
tests/sh/test_cu130_torch213_route.sh: the specs now come frominstall.shrather than literals in the test. Added cases:<2.14keeps the default;UNSLOTH_TORCH_UPGRADE=1moves a resident 2.13 to 2.14.tests/studio/test_cu130_torch213_route.ps1: the same cases forinstall.ps1.studio/backend/tests/test_cu130_repair_torch_specs.py: both installers' new-install specs are the top minor that the repair window keeps, and a resident 2.14.1 repairs to itself.Head test file against base vs head:
test_cu130_torch213_route.shtest_cu130_torch213_route.ps1test_cu130_repair_torch_specs.pyWhole-suite parity:
tests/sh/test_*.shgive the same exit codes on base and head.tests/studio/*.ps1give the same exit codes on base and head.test_early_python_path_resolver.ps1fails on both.GPU check (Colab RTX PRO 6000 Blackwell, driver 580.82.07 / CUDA 13.0)
The L4 could not be allocated, so this ran on a G4. Both arms ran on one VM, each in a fresh Python 3.13 venv with the cu130 trio. Then the PyPI
unsloth==2026.11.12was installed, followed by 10 steps of Unsloth LoRA SFT onunsloth/Qwen3-0.6B(seed 3407). The unsloth install did not move torch in either arm.jobs/compare.py:NO_REGRESSION. All 10 steps are within atol 1e-3 / rtol 5%, there are 0 graph breaks in both arms, and the only version difference is torch, which is expected.install.shin a fresh Studio home picked2.14.1+cu130fromwhl/cu130. The Studio stack then added torchao 0.18.0 and torchcodec 0.12+ for it.Staging CI
test_cu130_repair_torch_specs.py: 65 passedtest_cu130_repair_torch_specs.py: 65 passedThe macOS failure is
test_core_update_freezes_only_torch_past_the_released_ceiling[darwin-2.13.0-False]. It predates this PR and also fails on main:sys.platformbut notplatform.machine()._FreezeNewTorchForCoreUpdatefreezes every Apple Silicon release.Reproduced on base and head by forcing
platform.machine()toarm64: the same single failure on both. It is left for a separate fix.