Repository navigation
Installers (AMD, Linux): let new installs on the generic rocm7.2 index take torch 2.12 to 2.14 - #14350
Installers (AMD, Linux): let new installs on the generic rocm7.2 index take torch 2.12 to 2.14#14350danielhanchen wants to merge 5 commits into
Conversation
…x take torch 2.12-2.14
Codex Review SummaryThis 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. |
[skip ci]
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
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". |
|
Both find the 2.11 floor with |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
) ## Problem `tests/test_qat_phone_deployment.py::test_fake_quantized_embedding_unpickles_in_fresh_process`, added in #14376, fails in the CPU `Repo tests (CPU, rest)` shard on every PR whose merge includes #14376 (for example #14350): ``` File "/home/runner/work/unsloth/unsloth/unsloth/_gpu_init.py", line 245, in <module> import unsloth_zoo ... NotImplementedError: Unsloth cannot find any torch accelerator? You need a GPU. ``` The test pickles the fake-quantized embedding and loads it in a fresh `python -c` child. That class is defined in `unsloth.models._utils`, so unpickling imports `unsloth`. With a CPU-only torch, `unsloth` refuses to import. That refusal is by design, so the product is right and the test is not. The parent test process gets the CUDA spoof from `tests/conftest.py`, but the child has no conftest. ## Fix The child adds `tests/` to `sys.path`. When torch reports no CUDA, it applies `_zoo_aggressive_cuda_spoof` before unpickling, the same spoof the CPU CI uses. On a host with a real GPU the branch is skipped, so the child loads the embedding exactly as before. ## Verification In a CPU-only venv (torch 2.10.0+cpu, torchao 0.18.0, unsloth-zoo `e1d0b6d6d4` as CI installs it), with `PYTHONPATH` cleared: - main: the test fails with the error above. - This change: `tests/test_qat_phone_deployment.py` 20 passed.
…nstead of clearing them (#1913) ## Problem `tests/test_fused_forward_fp16_scaler.py::test_fused_forward_fp16_uses_accelerator_scaler` (added in #1906) fails in the unsloth repo's `Core zoo (HF=default + TRL=default)` job, which runs this suite with `-n 4 --dist loadfile`. It fails on unrelated PRs there, for example unslothai/unsloth#14392 and unslothai/unsloth#14350: ``` tests/test_fused_forward_fp16_scaler.py:45: in test_fused_forward_fp16_uses_accelerator_scaler assert fi.install_for_class(LlamaForCausalLM) E AssertionError: assert False ``` It passes on its own. It fails whenever `tests/test_fused_forward_install.py` ran earlier in the same worker: ``` $ pytest tests/test_fused_forward_install.py tests/test_fused_forward_fp16_scaler.py FAILED tests/test_fused_forward_fp16_scaler.py::test_fused_forward_fp16_uses_accelerator_scaler 1 failed, 34 passed, 11 skipped ``` That file's `fresh_install` fixture clears `_PATCHED`, `_UNMATCHED`, `_FAILED` and `_CANONICAL_FORWARDS` before and after every test. A class patched before the file ran keeps its rewritten `forward` but loses its `_PATCHED` entry. The next `install_for_class` on it then reads non-stock source and declines. Which file lands on which worker decides whether this shows up, so it looks intermittent. ## Fix Test only. The fixture still gives each test empty registries. It now snapshots the four registries first and puts their contents back afterwards, instead of clearing them on the way out. ## Verification Run on CPU (torch 2.10.0+cpu, transformers 5.17.0 as the `Core zoo` job uses, and 5.18.0), with `UNSLOTH_IS_PRESENT=1` and unsloth main on the path: - `pytest tests/test_fused_forward_install.py tests/test_fused_forward_fp16_scaler.py` - before: 1 failed, 34 passed, 11 skipped - after: 35 passed, 11 skipped - `tests/test_fused_forward_fp16_scaler.py` alone: 2 passed, before and after.
|
tested on two boxes: WSL Ubuntu 24.04 with 2x R9700 (gfx1201, ROCm 7.2.1), and bare-metal Mint 22.1 with an RX 9060 XT (gfx1200). Routing matches the PR on both: base gets 2.11.0, head gets 2.14.1 / 0.29.1 / 2.11.0, a re-run keeps the old release, Repair moves to 2.14.1, and one real problem, on WSL: 2.14.1+rocm7.2 aborts on the first the two red checks here were main's own reds in that window. Merging main merges cleanly and should clear them. Full table: LeoBorcherding#507 |
Problem
On Linux, AMD hosts that land on the generic pytorch.org
rocm7.2index are capped at torch 2.11 (#9932). That index now serves torch 2.12 through 2.14.1, and the cap is the only reason new installs never get them. It is also why a ROCm 7.14 or 10.x host keeps landing on the oldest build we install.The 2.11 cap was shared with the AMD per-arch indexes (Strix, RDNA 4, gfx103X, gfx110X), which really do stop at 2.11. Only the generic leaf needs the wider window.
Fix
install.sh: therocm7.2leaf gets its own arm,torch>=2.11.0,<2.15.0andtorchvision>=0.26.0,<0.30.0. torchaudio stays>=2.11.0,<2.12.0, since 2.11 is its last release and it pairs with all of these (same pairing the cu130 route already ships). The 2.11 floor for the_grouped_mmbug is unchanged.studio/install_python_stack.py: the update and repair path uses the same window for therocm7.2tag. The per-arch leaves and the Windows pins move to a separate_ROCM_TORCH211_PKG_SPECthat keeps 2.11 exactly, so they do not change. AUNSLOTH_TORCH_INDEX_FAMILY=rocm7.2pin now accepts 2.11 to 2.14 instead of repairing a 2.12+ build back down on every update.Not changed:
unsloth studio update(and the Desktop update) keeps any working ROCm torch, and an installer re-run keeps the resident release (rocm7.2still serves 2.11.0). Only Settings > Repair (UNSLOTH_TORCH_UPGRADE=1) moves an existing install to the newest build.Validation
torch builds on real gfx1151 (Strix Halo) hardware, Linux, each in a fresh venv with Unsloth main, 10 step LoRA SFT on Qwen3-0.6B plus matmul, SDPA forward/backward,
_grouped_mmandtorch.compilechecks:The 2.14.1+rocm7.2 wheel also carries gfx1103 kernels, which 2.11 does not.
Real
install.sh --localandunsloth studio update --localon a gfx1151 Linux runner (base = maind9aded380, head = this branch), training a 5 step LoRA throughPOST /api/train/startafter each step. The runner is a Strix box, so the generic route is reached withUNSLOTH_TORCH_INDEX_FAMILY=rocm7.2; the last row is the unpinned default.existing install has torch 2.11.0+rocm7.2 -- keeping itunsloth studio updateUNSLOTH_TORCH_UPGRADE=1)Resampleon the GPU worksunsloth studio updateTiming on the same gfx1151 runner, torch 2.11.0+rocm7.2 (A) vs 2.14.1+rocm7.2 (B), both from the rocm7.2 index with the same Unsloth: ABBA x2, a fresh process per measurement,
amd-smishowed no other process on the GPU before or after every run. Unsloth Qwen3-0.6B 16 bit, 580 token prompt, then 25 LoRA steps (median after 5 warmup). Median (min to max) of 4 runs per arm:No metric regresses; prefill is about 12% faster, training steps about 9% faster, decode and memory unchanged. Losses track each other step by step (0.487 to 0.043 vs 0.487 to 0.041).
Tests:
tests/sh/test_rocm72_torch_window_9932.shlifts the real case block out ofinstall.sh:rocm7.2gets the new window, every per-arch leaf and every other leaf is unchanged, and an existing 2.11.0 or 2.14.1 install keeps its release unless Repair is used.tests/studio/install/test_rocm72_torch_window_9932.py: the Python spec matchesinstall.sh, per-arch and Windows pins stay on 2.11, and therocm7.2pin accepts 2.11 to 2.14 and rejects 2.10, 2.15 and a non rocm7.2 build.tests/studio/install+tests/python/test_tokenizers_and_torch_constraint.py: 10095 passed. The same 4TestProgressStepCountMatchesTotalcases fail on main and here.tests/sh/*.shpass, and the related PowerShell pin tests pass.Fixes #9932 (the torch side for generic route hosts).