Repository navigation
Track PyPI for the transformers compat matrix - #11136
Merged
danielhanchen merged 1 commit intoSep 17, 2026
Merged
Conversation
The static tag list answers for the day it was edited. This reads the releases from PyPI, keeps one tag per minor to stay bounded, and merges the anchors no automatic rule can derive: the floor, the old Apple Silicon ceiling, the tokenizers breakpoint, the patch releases the notebooks pin, and the ceiling pyproject itself declares. Six failure modes found in review, each with a named test and each mutation proven: a fallback that dropped the anchors, a ceiling anchored to a literal, xdist workers collecting different matrices, a later patch evicting a pinned one, two CI lanes minting one pip cache key, and the shared matrix file bypassing the anchor merge. The CI lane restructure comes with it, since the matrix is what it feeds: floor, ceiling and latest on three interpreters and so three cache keys, with latest marked non-blocking because resolving outside the declared window is its job.
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. |
Member
Author
|
@codex review |
Member
Author
|
@codex security review |
danielhanchen
changed the base branch from
main
to
pr/lift-transformers-cap
September 16, 2026 18:33
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
This was referenced Sep 16, 2026
danielhanchen
merged commit Sep 17, 2026
51bee37
into
pr/lift-transformers-cap
70 of 82 checks passed
danielhanchen
added a commit
that referenced
this pull request
Oct 2, 2026
#11016) * Lift the transformers ceiling to 5.17.0 and align the torch mirror transformers<=5.5.0 was the ceiling, and 5.5.0 is exactly where the prequantized bnb-4bit checkpoints lose quant_state on every Linear4bit (#9867, #10010, #10017, #10276): measured 352 of 352 on unsloth/Qwen3.8-27B-unsloth-bnb-4bit, with the reporters' own "mat1 and mat2 shapes cannot be multiplied (10x5120 and 1x15728640)" on the forward. On transformers 5.17.0 the same load is 0 of 352 and the forward returns logits. The ceiling also put the Gemma 4 E4B LoRA fix one patch release out of reach, since that shipped in 5.5.2 (#5355). Raise the cap at both pyproject sites, keeping every != exclusion, and move the CI lanes that mirrored it: - studio-backend-ci.yml installed 'transformers>=4.51,<5.5' in two jobs, which had drifted BELOW the published ceiling: it excludes 5.5.0, the release every user resolved. - notebooks-ci.yml installed '<5.6' while notebooks in unslothai/notebooks pin 5.10.1, 5.15.0 and 5.15.1, so the API surface it dumps came from a release those notebooks never run on. - studio-export-capability-ci.yml installed 'torch>=2.4,<2.13', which excludes the torch unsloth_zoo now admits. version-compat-ci.yml gets the two ends of the range it was missing. zoo-imports-under-spoof and grpo-fake-run each become a two-lane include matrix: a floor lane (py3.10, torch 2.6.0, transformers 4.57.6, TRL 0.22.2, PEFT 0.18.0) and a latest lane that pins nothing. A new torch-free cap-site-consistency job runs the window-drift assertions on ubuntu, windows and macos. tests/version_compat/test_transformers_pinned_symbols.py gains v5.15.0 through v5.17.0. Studio's single-env keeps transformers==5.5.0. That pin is not this cap: it is the version the pinned installer ships, locked in step with a tokenizers window transformers enforces at import, and widening only the darwin override reproduces the Apple Silicon failure its comment documents. The comment now says so. Evidence: the whole 4.57.6 plus 5.0 to 5.17 sweep, and a real 27B bnb-4bit load on both sides of the old ceiling. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Install torchcodec and hf_transfer where the two new lanes need them Both new version-compat lanes went red on their first run and both reasons are about what the lane installs, not about the cap. torchcodec carries a compiled extension linked against one libtorch build, and torch on these lanes comes from the CPU index. Listed in the package step it was taken from PyPI, where the wheel is the accelerator flavour, and next to a torch 2.14.0+cpu it cannot dlopen. unsloth then does what it is supposed to do and disables it, seating the sys.modules absence sentinel, after which datasets 5 answers any Dataset.from_dict with ModuleNotFoundError: No module named 'torchcodec.decoders'; 'torchcodec' is not a package and the GRPO lane fails during collection. Moving it back onto the torch install line, which is where it sat before this branch split the lanes, lets pip prefer the matching +cpu build. Verified in a clean venv: torch 2.14.0+cpu with torchcodec 0.16.0+cpu imports torchcodec.decoders and builds a Dataset, the same pair with PyPI torchcodec 0.16.0 is what CI hit. The floor lane's 0.2 row is not published on that index at all, so the extra index still serves it from PyPI. hf_transfer is a declared unsloth_zoo dependency and the zoo is installed here with --no-deps, so the lane has to supply it. unsloth sets HF_HUB_ENABLE_HF_TRANSFER=1 around from_pretrained, and the huggingface_hub 0.x that the floor lane's transformers 4.57.6 pulls raises instead of falling back when the package is absent, which took out 45 tests. * Keep the pip cache names literal in the two new matrix jobs tests/studio/test_pip_cache_naming.py reads the workflow as text and requires every pip-cache-restore name to be lowercase letters, digits and dashes, because it goes into the cache key verbatim and the janitor groups on it. The two new include matrices named the cache after the matrix slug, which the action itself would have accepted at run time but which fails that lint, and took the workflow-trigger lint job down with it. The per lane name was not needed anyway. The key already carries the interpreter, pip-v2-name-os-arch-pyMINOR-hash, and the two lanes are python 3.10 and 3.12, so they cannot overwrite each other's wheels. Both names are back to the literals they had before the split, with the reasoning written next to them and a note that two lanes sharing one python would need the job split instead. tests/studio/test_pip_cache_naming.py: 116 passed, and 1 failed 115 passed without this change. * Trigger the version-window drift job on every cap file it scans * Run the floor lane on the declared minima, and scope the pin exception to one requirement * Pin the GRPO floor lane to the declared TRL and transformers minima * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim the comments in the files this PR touches Delete-first pass over the changed files: collapse multi-line rationale to one line, drop measured numbers, section banners, spacer lines and restatements of the code. Comments, docstrings and whitespace only, AST gated; no behaviour change. * Trim the export-capability workflow comments too * Read the transformers compat matrix from PyPI instead of pinning it This suite exists to say which versions the cap may be lifted to, so a hand-maintained tag list answers for the day it was edited. It now takes every minor at or above the 4.57.6 floor, latest patch of each, the same way tests/vllm_compat does for vLLM. One tag per minor keeps the matrix bounded as upstream keeps releasing. A patch that broke something specific earns its place in _ALWAYS rather than a blanket every-patch sweep: 5.5.0 is the old ceiling and still the Apple Silicon cap, 5.16.0 first required tokenizers>=0.23.1. Yanked, rc, dev and post releases are skipped, since pip will not install them. _TAG_OVERRIDES carries the one place upstream disagrees with itself: PyPI 5.10.4 is tagged v5.10.3. A frozen fallback list covers an unreachable PyPI, so a network failure cannot quietly shrink the matrix to nothing and report green. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the load bearing tags when PyPI cannot be read * Anchor the matrix to the ceiling pyproject declares * Resolve the matrix once so every xdist worker collects the same one * Anchor the patch releases the notebooks pin * Import the declared ceiling, and let the unpinned lane be a canary * Give the ceiling lane its own pip cache key * Anchor the shared matrix too, and derive the ceiling tag through the override table * Split the PyPI-tracking matrix out of the cap lift The dynamic matrix, its anchors and the CI lane restructure move to their own PR. This branch keeps the cap lift, the four cap sites, the drift gate and a static tag list that covers the window the cap opens: 4.57.6 and every 5.x minor through the declared ceiling v5.17.0, plus the v5.10.1 and v5.15.1 pins several notebooks carry. * Raise the transformers floor to 4.52.4, which is the oldest one that imports The declared floor was transformers>=4.51.3 beside peft>=0.18.0, and that pair cannot import: peft declares no transformers floor of its own, and peft 0.18.0 imports GradientCheckpointingLayer from transformers.modeling_layers at peft/tuners/lora/model.py:26, a module that first exists in transformers 4.52.0. pip resolved it happily and import unsloth then raised ModuleNotFoundError. 4.52.4 rather than 4.52.0 because 4.52.0 through 4.52.3 were already rejected by name; those exclusions are now dominated by the floor and drop out. Measured, not inferred: the floor lane's import set was run at 4.51.3 (5 failed, 21 passed, matching CI exactly), 4.52.0, 4.52.4, 4.53.1 and 4.54.1 (34 passed each), so modeling_layers was the only missing piece. tests/test_transformers_cap_sites.py grows the mirror of its ceiling gate: TESTED_FLOOR, a check that both version-compat floor lanes pin the declared floor, and a negative control that the window still refuses 4.51.3. test_trl_loss_normalization_contract.py checked DPO with hasattr, which has been false since trl 0.21 declared loss_type with a default_factory, so that half was skipped on recent TRL and wrong at the floor. DPO and KTO are now compared to pristine TRL, whose values are version-dependent, while GRPO stays the literal bnpo that rl.py deliberately pins. * Let the TRL floor lane's training tests run at the declared floor The lane's two loaders passed dtype = torch.float32 to from_pretrained. That kwarg is rejected at the transformers 4.52.4 floor, where from_pretrained forwards it into the model constructor, so 45 tests died with TypeError: LlamaForCausalLM.__init__() got an unexpected keyword argument 'dtype' the moment the lane could import at all. torch_dtype spans the window but is deprecated from 4.57.6 on, so neither literal is safe: load with neither kwarg and cast after, asserting the parameter dtype really is float32 so the cast cannot silently no-op. tests/version_compat/test_no_dtype_kwarg_at_load.py keeps it that way, an AST scan of every test in the directory for a dtype or torch_dtype kwarg on from_pretrained, with five parametrised controls including a dtype kwarg that is not a load at all. test_pristine_trl_config_without_max_seq_length_still_truncates asserted a precondition it cannot control: the regression only exists on a TRL that dropped max_seq_length, and trl 0.18.2 still declares it. It skips with that reason now, the same way the file already skips an unreachable hub. * Add the call-site guard that keeps a dtype kwarg out of these loaders An AST scan of tests/version_compat for a dtype or torch_dtype kwarg on from_pretrained. Neither spelling holds across the declared transformers window: dtype raises TypeError at the 4.52.4 floor and torch_dtype is deprecated from 4.57.6 on, so the durable rule is to load without either and cast the result. Five parametrised controls, including a dtype kwarg that is not a load. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Require the unsloth_zoo release that carries the same transformers ceiling pip intersects unsloth's transformers window with unsloth_zoo's own, and published unsloth_zoo 2026.9.4 still says transformers<=5.5.0, which is exactly the cap this PR lifts. Without a matching zoo floor the lift is advertised and not delivered. Move the declared zoo floor to the first release expected to carry the lift and add a gate: with the floor back at 2026.9.4 the new test fails, naming the intersection. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Read the tightest upper bound, and keep the exemption list honest _ceiling took max over the upper bounds, so raising a cap by adding a bound without removing the old one (<=5.17.0,<=5.18.0) reported 5.18.0 while pip still resolved at 5.17.0. Take the tightest bound instead, with < beating <= at equal versions. PINNED_BY_DESIGN carried a placeholder for a requirement no lane spells. That is not documentation, it pre-authorises that exact string: reintroduce transformers<=5.5.0 in that workflow and the scan finds it and then skips it. The dict is empty now, and a new test requires every entry to match a requirement a lane really spells today. * Hold the unsloth_zoo floor at 2026.9.4 until the matching release ships unsloth_zoo 2026.9.5 does not exist on PyPI; 2026.9.4 is the newest published release. `unsloth_zoo>=2026.9.5` is therefore a floor no release satisfies, which makes unsloth uninstallable rather than merely under-delivering the lifted transformers window, and it blocks this PR. Revert the three pyproject sites to 2026.9.4, which is what main carries, and rewrite the comment above the floor so it no longer contradicts the pin: it now says the floor is held here and names what still needs the newer zoo. The gate that asserts the floor is deferred rather than deleted, so it stays the reminder to raise the pin later. ZOO_FLOOR_WITH_LIFTED_TRANSFORMERS_CAP is None, the test skips with a reason naming unslothai/unsloth-zoo#1227, and setting the constant to the release that ships #1227 re-enables it in one edit. The half of that gate that does not depend on which release the floor names, that there is exactly one zoo floor and that it is a real lower bound, still holds at 2026.9.4 and is split out into test_pyproject_declares_one_unsloth_zoo_floor, which keeps running. Known and accepted while this stands: pyproject advertises transformers up to 5.17.0 while the resolvable zoo still caps it at 5.5.0, so the lift is declared but not yet delivered. * Track PyPI for the transformers compat matrix (#11136) The static tag list answers for the day it was edited. This reads the releases from PyPI, keeps one tag per minor to stay bounded, and merges the anchors no automatic rule can derive: the floor, the old Apple Silicon ceiling, the tokenizers breakpoint, the patch releases the notebooks pin, and the ceiling pyproject itself declares. Six failure modes found in review, each with a named test and each mutation proven: a fallback that dropped the anchors, a ceiling anchored to a literal, xdist workers collecting different matrices, a later patch evicting a pinned one, two CI lanes minting one pip cache key, and the shared matrix file bypassing the anchor merge. The CI lane restructure comes with it, since the matrix is what it feeds: floor, ceiling and latest on three interpreters and so three cache keys, with latest marked non-blocking because resolving outside the declared window is its job. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Raise the unsloth_zoo floor to 2026.9.5 Main moved to 2026.9.5 in #11210, so this branch's 2026.9.4 was a regression against main. 2026.9.5 also settles the second of the two reasons the floor was tracked: it carries the generated-sentinel fix (unslothai/unsloth-zoo#1259). The transformers half stays outstanding, since 2026.9.5 still declares transformers<=5.5.0 pending unslothai/unsloth-zoo#1227. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make the zoo deferral expire by itself instead of on a hand-written constant Codex raised (P1) that `unsloth_zoo>=2026.9.5` still admits a zoo whose own metadata says `transformers<=5.5.0`, so pip intersects the widened range back down and users keep resolving 5.5.0. That is correct, and it is measured: enumerating all 230 published transformers releases, this branch widens the unsloth side by 26 cells, but the range a user actually resolves (ours intersected with published unsloth_zoo 2026.9.5) moves by 0 newly admitted cells. 229 of 230 cells are identical and the one that moves is 4.51.3 becoming rejected, which is the floor fix. The requested remedy cannot be applied here. Raising the unsloth_zoo floor to the release carrying unslothai/unsloth-zoo#1227 requires that release to exist, and it does not; a floor no published release satisfies makes unsloth uninstallable, which is why the floor never leads the release. That reasoning is already in the comment above the floor and in the deferred gate's docstring. What was genuinely wrong is the shape of the deferral. `test_the_declared_zoo_floor_can_supply_the_declared_transformers_window` skips while `ZOO_FLOOR_WITH_LIFTED_TRANSFORMERS_CAP` is None, and that constant is hand-written, so on the day #1227 ships nothing turns red: the gate keeps skipping and the floor keeps naming a zoo that caps at 5.5.0 for as long as nobody looks. That is "a site left behind after the window moves does not go red", which is the failure this whole file exists to catch, reproduced inside its own deferral. `test_the_zoo_deferral_expires_when_the_zoo_release_ships` closes it. It asks PyPI what the newest published unsloth_zoo allows and fails only on POSITIVE evidence that the deferral is obsolete, naming the release to pin and the constant to set. No network, a timeout, a malformed answer or a zoo with no readable ceiling all leave it skipped, so it can never go red by failing to reach PyPI. That preserves the property that put this suite on the three-OS cap-site job: offline runs stay honest. Verified in all three directions rather than by reading: shipped zoo (2026.10.1 admitting 5.17.0) -> fails, message names the release PyPI unreachable -> Skipped, never a failure live PyPI today -> zoo 2026.9.5 caps 5.5.0 < declared 5.17.0, so the deferral correctly stands Suite is 25 passed, 1 skipped. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Start the symbol matrix at the declared floor, and anchor the release with no tag Codex raised (P2) that `_FLOOR` was a literal 4.57.6 while this PR moves the declared floor to 4.52.4, so `_release_tags()` discarded every 4.52 through 4.56 release and the matrix could stay green while a source-pattern or symbol dependency broke supported users. Confirmed: the floor was the only hardcoded end of the window in this file, since the ceiling is already read from pyproject through `_CAP` for exactly this reason. `_FLOOR` is now derived the same way, by `_declared_floor()`, taking the LOWEST `>=` in the file so a marker-gated half declaring a higher floor cannot raise it and hide releases the other half still admits. A bad read falls back to 4.52.4 rather than widening the matrix to every release ever published. Widening it turned up a real defect, which is the point of having done it. On the first run 4.54.1 failed five checks, all on the fetch rather than on a symbol: v4.54.1: src/transformers/trainer[.py|/__init__.py] both missing 4.54.1 is on PyPI and inside the window, but upstream never pushed a v4.54.1 tag. The only 4.54 refs are v4.54.0 and v4.54-release. Checked directly rather than assumed: v4.54.1 tag ref HTTP 404 v4.54.0 __init__ __version__ 4.54.0 (so it is NOT this release) v4.54-release __version__ 4.54.1 (trainer.py HTTP 200) so the entry is `"4.54.1": "v4.54-release"`, the same shape as the existing 5.10.4 entry and for the same documented reason. `_sort_key` now resolves a tag back through the override table before parsing it, since a tag whose name is not a version string has to sort by the release it carries. With both changes the matrix runs 4.52.4 through the ceiling: 523 passed, 9 skipped, against 506 passed, 21 skipped and 5 failed when the floor was widened alone. `test_the_matrix_starts_at_the_declared_floor` keeps it from drifting back. Mutation proven: restoring the 4.57.6 literal turns it red on 23 of 28 tags, and the restored tree is 28 passed. * Start the outage fallback at the declared floor too Codex raised (P2) that deriving `_FLOOR` fixed only the live path: `_TAGS_FALLBACK` is a separate frozen list and still began at v4.57.6, so any PyPI failure dropped every 4.52 through 4.56 check and CI could go green straight through a regression at the low end this PR newly supports. Correct, and it is the same defect as the one just fixed, one code path over. `_ALWAYS` does not cover it either: those anchors are the Apple Silicon ceiling and the tokenizers breakpoint, both 5.x. The fallback now starts at the declared floor, one tag per supported minor below the old start: v4.52.4, v4.53.3, v4.54-release, v4.55.4, v4.56.2. 4.54 goes in under its real tag for the reason `_TAG_OVERRIDES` already records. `test_the_outage_fallback_reaches_the_declared_floor` holds it there under a simulated outage, asserting both that the oldest tag reached is at or below the declared floor and that no supported minor between 4.52 and 4.56 is missing, so restoring one tag while dropping the rest does not pass. Mutation proven: putting the fallback back to a v4.57.6 start turns it red, restored is 2 passed. Full suites 577 passed, 10 skipped. * Keep the ceiling lane inside the declared datasets window, and compare zoo bounds by membership Two P2 items from the last review, both genuine. The ceiling lane installed `datasets` bare. Both checkout installs in that job use --no-deps, so pyproject's `datasets>=3.4.1,!=4.0.*,!=4.1.0,<4.4.0` never reaches the resolver and the bare name takes the newest release, which is datasets 5 today. A blocking lane whose purpose is to isolate compatibility with the transformers ceiling would instead fail on a datasets release the project does not support. It now carries the declared window verbatim, as the floor lane already does. The `latest` lane stays bare on purpose: resolving outside the window is that lane's entire job. The second is a bug in the deferral-expiry check added earlier in this PR. `_newest_published_zoo_transformers_ceiling` recorded `<` and `<=` alike as a bare ceiling Version, so a future zoo declaring `transformers<5.17.0` would have been read as covering this project's `<=5.17.0` window and expired the deferral on a release that still cannot resolve our ceiling. It now keeps whole SpecifierSets and asks whether the declared ceiling is a MEMBER of the published zoo's window, which is the actual question. Verified both directions against the case named in the review: zoo `>=4.52.4,<5.17.0` -> deferral correctly STANDS, no false expiry zoo `>=4.52.4,<=5.17.0` -> correctly fails, naming the release to pin Suites are 577 passed, 10 skipped. * Let the GRPO left-pad probe resolve at the declared TRL floor The injected probe tried has_images and fell back to images with no third branch. TRL 0.18.2 and 0.19.1 bind neither name in _generate_and_score_completions and have no vision path at all, so the fallback raised NameError out of the except handler and took GRPO training down at the bottom of the declared window. 0.20.0 through 0.23.1 bind has_images, 0.24.0 and up bind images. Resolve a text-only flag through all three cases, then compute the pad once. tests/version_compat/test_grpo_left_pad_probe_at_the_floor.py executes the rewritten function against each binding shape and re-derives the table from upstream sources, and is wired into both GRPO fake-run lanes. Also names tests/version_compat/test_no_dtype_kwarg_at_load.py in the pinned-symbol matrix, which is what test_version_compat_bundle.py asks of every suite that exists. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Resolve the GRPO importance sampling level at the declared TRL floor The rewritten compute_loss read self.importance_sampling_level unconditionally and passed it to both the no-grad and the gradient loss path. That attribute is GSPO's and arrived in TRL 0.20.0, as a GRPOConfig field the trainer copies onto itself. 0.18.2 and 0.19.1 have neither the field nor the attribute, so GRPO training died in the first training_step at the bottom of the declared window: AttributeError: 'UnslothGRPOTrainer' object has no attribute 'importance_sampling_level' Read off upstream rather than inferred: grpo_trainer.py binds self.importance_sampling_level 0 times at 0.18.2 and 0.19.1, and 5 or more from 0.20.0 on, with grpo_config.py matching. Resolve through the trainer attribute, then the config field, then 'token'. The fallback is not invented: 'token' is the default TRL's own field declares, it is what unsloth_zoo's grpo_compute_loss already defaults to, and 0.18.2 has no sequence level path at all. Versions that bind the attribute are unaffected, since it is found first. tests/version_compat/test_grpo_importance_sampling_level_at_the_floor.py execs the real rewritten source and captures the level the loss actually receives, over both loss paths and all three binding shapes, and re-derives the upstream table so a future TRL that moves the knob fails here rather than in a training loop. Mutation checked: reverting either call site turns 4 of 7 red, and the 3 that stay green are the arms the bug never touched. Second of this family, after the left-pad probe. Same shape: injected source assuming a TRL binding the floor does not have. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Supply the Docker Hub credential the way the workflow now takes it Both harnesses handed the step its key by replacing `${{ secrets.DOCKER_API_KEY }}` in the `run:` body. The key has since moved into the step's `env:` block so it is never a command-line argument, which means that replace matches nothing: the body builder died with KeyError, curl was handed an empty request, and the step still exited 0 because the failure was inside a pipeline. The stub also logged only "$*", and the auth body is passed on stdin via `--data-binary @-`, so the identifier could not be observed even when it was sent. The harnesses now set DOCKER_API_KEY in the environment and the stub appends the stdin body to the log, only when curl was actually told to read stdin. Both halves are load-bearing: removing either one fails the assertion again. The workflows themselves are correct and unchanged; an empty token is caught by their own `-z "$TOKEN"` check. This was the test harness drifting behind them. A new test in each file pins that the step takes DOCKER_API_KEY from `env:` and keeps no `${{ }}` in its body, so a rename fails loudly instead of quietly returning these assertions to describing an empty request. * Cut the comments in the files this PR authors Opening comment-reduction pass over the five files this PR writes in full or near enough. 422 comment lines to 342 across them, 26.9 percent to 23.0. Long rationales collapse to the one fact that is not recoverable from the code: the version tables, the traps each constant exists to avoid, and the citations. Tracebacks and narration go, since the PR description carries them. Files the PR barely touches are left alone. rl_replacements.py changes 27 lines of 3658 and test_trl_padding_free_max_length.py 21 of 3678; rewriting their comments would grow the diff well past what a dependency cap lift should contain. Comment-only, AST-verified with comment_tools.py check: 5/5 code unchanged. * Second comment sweep: delete the restating summary lines Sweep one shortened, this one deletes. Each remaining paragraph docstring loses the summary line that restated the test name, keeping the fact the name does not carry. 342 comment lines to 301 across the files this PR authors, 23.0 percent to 20.5; from 422 at the start of the pass. Not taken to the 15 percent target: what is left is version tables, the trap each constant exists to avoid, and issue citations, and cutting those is the one outcome worth avoiding. Comment-only, AST-verified with comment_tools.py check. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Skip the GRPO floor suites off-runner instead of erroring collection Both files import the real rewriter, so unlike the cap-site suites they cannot be file-only. On a runner without torch `import unsloth` raises its own ImportError("Unsloth: torch not found"), and a bare module-scope import turns that into a COLLECTION ERROR: the cross-platform staging run was red on ubuntu, macos and windows for exactly this, having tested nothing. pytest.importorskip does NOT cover this case, which is worth writing down because it is the obvious first fix and it does not work: it skips a module that is ABSENT and re-raises an ImportError the module body raised itself, which is precisely what unsloth does here. Verified against a stub package that raises ImportError on import: importorskip still ends in "1 error during collection", the try/except ends in "1 skipped". Both directions checked on the real files: with torch present all 13 tests run, and against a stub unsloth that raises, both modules skip and the run exits clean. * Lift the TRL ceiling to 1.13.0 and gate the range that was already being tested (#11137) * Keep more VRAM headroom on Windows CUDA, and say when a hand-set context does not fit (#11368) * Stop a Windows host-RAM spill from looking like a healthy load On Windows, cudaMalloc does not allocate device memory directly. It asks the WDDM kernel memory manager, which treats VRAM and system RAM as one demand paged pool, and since driver 536.40 an allocation past the end of VRAM succeeds out of host RAM instead of returning out of memory. The load starts, exits 0, answers /health, and nvidia-smi shows a healthy card, while decode re-reads the spilled bytes over PCIe on every token. Linux has no such path. The same allocation fails with "cudaMalloc failed: out of memory" and llama-server exits, which is measurable: with 12 GiB free, Qwen3-VL-8B at -c 65536 asks for 9216.00 MiB in one allocation and refuses to start. That is why every rung of the spawn loop's recovery ladder is gated on a non-zero exit code, and why the whole ladder is dead on the one platform that needs it. Three changes: Raise the per-device reserve to 1024 MiB on Windows with a discrete CUDA build, capped at an eighth of the card so it stays proportionate on small GPUs. This is not a new magic number, it is the per-device margin llama.cpp's own fitter keeps when nobody tells it otherwise, and where our estimate carries all the risk we should be at least as conservative as the child would have been. Linux and macOS budgets are unchanged, and the monotonicity property in _vram_reserve_floor_mib still holds at every fraction. After a full GPU pin comes up healthy, check that the load is actually resident. Windows exposes the spilled bytes itself through the '\GPU Adapter Memory(*)\Shared Usage' counter behind Task Manager's shared memory figure, which nvidia-smi cannot see because on WDDM it reports dedicated VRAM only. That counter is per adapter rather than per process, so it is believed only when the device side independently shows the child short of the weights plus KV cache that full offload must place on the card. Report only, no recovery. Warn when a hand-set context does not fit. The planner already prices this correctly and already hands the load to --fit, but said nothing about why the context was flexed. The notice also re-prices at q8_0 and mentions it when that would make the configuration fit, rather than changing a user's cache dtype for them. Refs #11349, #11336 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim comments in the Windows sysmem fallback change * Keep the residency check and context notice from making false claims The residency check read only -ngl and --fit, so a user extra appended after the pin that keeps weights or the KV cache on the host (--cpu-moe, -ot, -ncmoe, -nkvo, --device none, or their LLAMA_ARG_ env twins) was reported as a host RAM spill. The =-form overrides (--gpu-layers=10, --fit=on) were missed the same way. The overcommit notice offered the Auto fallback anchor as the largest context that fits when the weights alone overflow every GPU subset, so lowering the context to that figure would still not fit. Only offer a context when one fits. * Scope the residency check to CUDA builds, the loaded adapter and its own process Arm only when the resolved build is CUDA: a Vulkan launch on an NVIDIA host has no CUDA sysmem fallback and its ordinals are not NVML indices. Read Dedicated Usage beside Shared Usage and count shared growth only on the adapters whose VRAM grew across the spawn, so a display iGPU's churn on an Optimus laptop is no longer booked as the model's spill. Hand the verifier thread a snapshot of the armed state and the child it was started for, and drop its result if that child has since been replaced. * Check residency before the load returns, and keep its advice accurate Run the residency check synchronously once the final child is ready, after every post-health respawn, so the verdict describes the process that is actually serving and reaches the load response. A warning written after the response was never shown. The spill notice is appended to an earlier one instead of losing first-notice-wins. Offer q8_0 only when the cache is still f16, cap the counted adapters at the number of pinned cards, key the sysmem-fallback cache by the resolved binary, and use the Windows wording in the context notice only for CUDA builds. * Gate the direct spill signal on a full card, and settle before re-baselining The measured delta carries the CUDA context and compute buffers, so requiring it to fall short of the weights+KV floor masked small spills such as the 74 MiB case. WDDM only spills once dedicated VRAM is exhausted, so count shared growth when a pinned card is nearly full instead. Wait for a killed retry child's VRAM to settle before sampling the next baseline, and price the q8_0 hint's compute scratch at q8_0. * Report the measured spill, judge a full card by its own reserve, drop a stale notice Name the counter's measured shared-memory growth as the spill amount on a direct hit; the floor delta can be negative there, since it carries the CUDA context and compute buffers. Treat a card as full below its proportional sysmem-fallback reserve rather than a flat 1 GiB, so small cards are not flagged. Publish the context overcommit notice only when the final plan still hands the load to --fit on, since slot reduction can re-pin it. * Word the context notice for planned offload, and tighten the spill report The overcommit notice fires only once the load was handed to --fit on or a spill plan, both of which place host tensors deliberately, so the Windows driver-fallback wording and NVIDIA setting never applied there. Use the CPU offload wording on every OS. Sum only positive shared growth across pinned adapters, report spills under 1 GiB in MiB instead of rounding them to 0.0 GB, and key the fallback classification by build revision so an in-place runtime update is re-read. * Disarm the residency check on a KV layout change, skip the notice under -nkvo A retry that respawns with a different slot count or unified-KV setting holds a different cache than the floor was priced for, so disarm instead of comparing against the stale floor. With KV offload disabled the cache stays on the host, so the context overcommit priced from GPU KV bytes is not real. * Do not cache an empty backend scan _installed_ggml_backends returns an empty set for an unreadable lib dir instead of raising, so the transient-failure rule has to cover that result too. Also let the residency tests import their sibling harness when run on their own. * Keep host-only tensors out of the residency floor, and tighten the notices Subtract an untied token_embd (kept on the CPU at full offload) and MTP blocks that do not load from the floor, by the same rules _unified_need_now uses, so a healthy load is not flagged as a spill. Skip the context notice when the user placed tensors on the CPU or fixed the layer count, offer q8_0 only when flash attention is planned on, and name the executable actually launched in the driver-setting advice. * Trim comments added during review * Drop the post-load residency check; keep the Windows reserve and the context notice The spill detector could not be validated on Windows NVIDIA hardware and was most of this change's size and risk. Keep the two parts that stand on their own: the raised sysmem-fallback reserve on Windows CUDA builds, and the advisory when a hand-set context does not fit. The backend classifier tests move to the reserve's test file. * Skip the context notice for an env-fixed layer count or at the native ceiling An inherited LLAMA_ARG_N_GPU_LAYERS is a deliberate placement like the argv flags. When the ceiling sweep stopped at the native context, a larger rope- scaled window was never searched, so the largest context that fits is unknown. * Skip the context notice when the user turns the fitter off User extras follow the generated --fit on, so a trailing --fit off disables the fitter and nothing moves layers to the CPU; the notice would claim otherwise. * Register the q8_0 what-if in the split-rate call-site guard * Trim comments in the Windows reserve change --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Unsloth Studio (AMD): keep export off a GPU PyTorch has no kernels for, like the iGPU (#11946) * Studio: keep export off a GPU the installed PyTorch has no kernels for * Trim comments restating the code * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Read the hot-path I/O cost at its steady minimum across repeats (#12029) * Unsloth Studio: a companion fetch with no denoiser no longer blocks deleting its base (#11828) A cached repo counts as needing a companion base only if it holds a runnable denoiser. The VAE-only fetch the native engine leaves in unsloth/Qwen-Image-2.1-FP8, and the default pre-cast fp8 text encoder a diffusers load caches at that repo's root, no longer pin Qwen/Qwen-Image-2.1 from a row the On Device list cannot act on. A prequant repo holding its DiT checkpoint still pins its base. Fixes #11825. * Studio: stop Python tool network calls from skipping the host allowlist (#11172) * Studio: check the sandbox host allowlist for keyword, variable and aliased hosts in Python network calls * Drop two sandbox comments that restate the code below them * Keep resolving a network alias when the name is rebound elsewhere * Rank network alias stores by the call they reach and ask on depth exhaustion * Refuse a network target that is out of policy on any competing store * Check a connect receiver that is a tracked client on any path * Keep a valueless store unresolved instead of dropping it * Read class-body names in source order and match only urllib3 calls that connect * Check every candidate signature and scope attribute receivers to their owner * Check the proxy and pool entry points urllib3 exports * Carry unpacked values to the target they bind * Memoize alias resolution so a branching chain stays linear * Ask when alias resolution gives up on the callee * Expand conditionals so every branch of a target is checked * Let an unconditional rebinding replace the value a later read sees * Check session and pool request methods, and only supersede on a certain binding * Keep the enclosing binding when a class store may not run * Take each client method's URL position from its real signature * Check client base URLs, parameter defaults and self-referential stores * Resolve prebuilt requests and check explicit proxy destinations * Cover OPTIONS and the modules these APIs are actually defined in * Resolve a client kept on an attribute * Follow base classes, cover session uploads and websockets, drop the quadratic scan * Make a binding take effect at the end of its statement * Resolve a walrus callee to the callable it assigns * Apply the literal-target fallback only to listed entry points * Only read a call result as its constructor when that names a known client * Cover raw urllib3 connections, renamed receivers and disabled proxies * Treat the lowercase session factory and aiohttp's request helper as entry points * Resolve constant getattr dispatch and cover aiohttp uploads * Check the payload where a request is built * Bind a definition name after its header runs * Keep the stores that resolved when a sibling store hits a cycle * Resolve a connect receiver with the same resolver as every other callee * Put a client's connect in the target table and stop reading stores that have not run * Generate the urllib3 URL factory specs from the module that defines each * Keep source order inside the body that does the reading * Check the encoded pool helpers and a proxy set on the session * Give attribute stores the same reaching rule as name stores * Tie a receiver's attributes to the binding in effect at the call * Parse the URL the client will send, and follow a mutated proxy mapping * Sequence a finally block with the statements that follow the try * Key attribute stores on the whole receiver path * Read attribute stores under the dotted paths they are recorded with * Port client, proxy and SSH egress coverage onto the alias screen from main * Trim comments on the ported egress tables * Track annotated assignments, share proxies across client copies, skip static methods * Treat local client subclasses as the client, and follow aliased proxy mappings * Read base_url stores on a client and in-place proxy merges * Scope client destination attributes to the client that reads them, and cover asyncssh.connection * Resolve network submodule paths to the names their package re-exports * Read a proxy without a scheme as a host * Skip mapping keys and None destinations * Skip no_proxy entries in proxy mappings * Screen uploads through httpx stream, and follow clients passed to local functions * Track subclasses of connecting classes, and read httpx transport proxies * Follow clients passed to local methods * Propagate clients along every recorded copy, and bind unbound method calls * Track clients bound by loop and comprehension targets * Follow clients returned by local factories, and link helper parameters to their callers * Follow factory methods and awaited factories * Follow aliases of local functions * Read class-body clients in their own body, and read authority-relative URLs * Screen PoolManager.connection_from_host * Bind calls and index flows after every alias is collected * Tighten comments on the egress screen additions * Screen datagram destinations on sendto and sendmsg * Apply proxy stores after binding, and read proxy environment variables * Resolve os and environ aliases for proxy environment stores * Screen urllib openers and ProxyHandler mappings * Follow wrapper instances, read environment mappings, and scope environment proxies * Reach inherited client methods through self, and read expanded environment updates * Read mutated environment mappings and os.environ merges, and honour aiohttp trust_env * Resolve environment keys held in variables, and bind local constructor arguments * Treat lambdas bound to a name as local functions * Handle annotated assignments through the same binding path as plain ones * Follow inherited initializers, inline wrappers, environ aliases and super() * Carry os.environ through helper parameters * Check asyncssh tunnel and proxy_command, and honour httpx trust_env=False * Treat a paramiko sock argument as unreadable * Screen asyncssh.connect_reverse, and follow clients returned by properties * Carry the os module through assignments and helper parameters * Check SSH routing keywords from one table, including Fabric gateway * Limit the sock routing rule to SSHClient.connect * Check asyncssh connection options, and read named proxy mappings * Follow bound local methods saved under another name * Track proxy-manager factories and SOCKSProxyManager as pool clients * Read a path with a relative literal prefix as hostless * Read a wholesale os.environ replacement * Trim comments in the egress screen additions * Index shadowed names by scope so the egress screen stays linear on class-heavy code * Read a backslash as the end of the host, and follow class attributes and unpacked factory tuples * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Read proxy writes through os.environb, and fail closed on a Fabric connect_kwargs sock * Never trust a host with a backslash, and read filled-in Fabric kwargs and getattr environ writes * Check positional SSH route arguments for paramiko connect and Fabric Connection * Read an explicit environ __ior__ call like update * Trim comments in the egress screen fixes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Maheswar Kumar <[email protected]> Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Studio: center collapsed sidebar icons and tighten the rail (#12031) * Studio: center collapsed sidebar icons and tighten the rail The nav icon's expanded-row nudge also applied in the collapsed rail, leaving each icon 2px right of its hover circle. Drop it there, use 30px round hover targets throughout the rail (including the open sidebar toggle), and sit the settings cog one nav row above the avatar. * Studio: shrink collapsed sidebar hover circles to 28px * Unsloth Studio: list a GGUF with no header metadata under On Device on the Images page (#11830) * Studio Hub: classify a GGUF whose header names no architecture from its name unsloth/Qwen-Image-2.1-GGUF files carry no general.* keys at all, so _arch_to_task answered None. The Images picker filters On Device rows on an exact task and dropped the row; the unfiltered Chat picker listed it and refused it. A readable header that names nothing now takes the same name-only route as a cloud placeholder. * Trim comments on the no-architecture GGUF classification * Keep the MiniMax-H3 conditioner out of the name-only video route --------- Co-authored-by: Daniel Han <[email protected]> * Keep the conversion backfill's donor stub off the transformers package (#12034) * Unsloth Desktop: show Stopping… after Stop so a pending cancel doesn't look ignored (#11976) * Studio: show Stopping… after Stop so a pending cancel doesn't look ignored * Studio: tighten stop-label comments --------- Co-authored-by: Daniel Han <[email protected]> * Studio: stop edit_file writing a compacted-argument placeholder into files (#11950) * Studio: stop edit_file writing a compacted-argument placeholder into files * Trim comments in the compaction receipt guard --------- Co-authored-by: Daniel Han <[email protected]> * Studio: decode Wan video in fp16 with channels_last_3d convs (#11999) * Studio: decode the Wan video VAE in fp16 with channels_last_3d convs * Format * Trim the fp16 decode docstring * Trim fp16 decode comments * Unsloth Studio: refuse picking a hosted FP8/INT8 checkpoint repo as a pipeline before it downloads (#11829) * Studio: refuse a pipeline pick of a hosted prequant repo before it stages anything A pick of unsloth/Qwen-Image-2.1-FP8 with no file name is a pipeline load, and validate_load_request let it through: the family detects from the id and unsloth/ clears the trust gate. The plan staged the repo's 14 GB of checkpoints, then from_pretrained 404d on the model_index.json the repo does not have. The hosted prequant repos are now a table (prequant_only_repo_ids) and a pipeline pick of one is refused with the base repo and precision to pick instead. * Skip the hosted prequant-repo pipeline refusal when repo_id is an existing local path - The new prequant-repo pipeline refusal matched the repo id by exact string, so a local pipeline directory cloned to that same relative name (e.g. ./unsloth/Qwen-Image-2.1-FP8 with a valid model_index.json) was wrongly rejected. It now skips the refusal for local paths and lets the existing local manifest validation handle them. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: trim comments in prequant pipeline-pick refusal --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]> * Studio: stop the second prompt length recompiling Qwen-Image on the max tier and with int8 (#11842) * Studio: compile the prompt-length dims of Qwen-Image DiT blocks dynamic from the first render The max tier (and torchao weights on the default tier) compiles DiT blocks with automatic dynamic, so the first prompt's token count was compiled static and the first prompt of a different length recompiled every block graph into the generalised form it then kept (Qwen-Image-2.1: 14 s int8 default, 31 s bf16 max, 51 s int8 max; Qwen-Image: 52-57 s max). Name the block inputs whose size follows the prompt in torch.compiler.config.dynamic_sources, set only around the owning transformer's forward and restored even when it raises, so the first compile already builds the generalised graphs. The first segment start of Qwen-Image-2.1 stays static, which keeps clear of the torchao CantSplit that dynamic=True hits. The compile-cache key gains the allowlist only for these families. torch without the knob (2.6) is unchanged. * Studio: also mark Qwen-Image's text inputs dynamic when FBCache calls the blocks through hooks FBCache is on by default for Qwen-Image, and its hooks pass the block inputs as kwargs (or a resumed frame's stack after a graph break), so the plain L[...] names never matched and the second prompt length still recompiled. Suffix patterns cover those paths on torch 2.8+. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: ruff format * Arm the prompt-length allowlist only on torch 2.8+ torch 2.7 caches its first read of compiler.config.dynamic_sources for the life of the process, so scoping the list to one forward is either ignored or leaks it into every later compile. 2.8 re-reads it when it changes and adds regex matching (is_dynamic_source), which the FBCache hook paths also need. Older torch keeps today's behaviour. * Trim comments * Trim comments on the prompt-length allowlist * Trim dynamic text dims comments * Drop dead torch<2.1 hook fallback and redundant in-test skips * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten dynamic text dims docstrings --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Studio: size the image memory plan at the dtype the pipeline loads in (SDXL resident on 24 GB) (#11922) * Studio: size the diffusion memory plan at the dtype the pipeline loads in The pipeline memory plan summed the cached shard bytes, which is what a repo stores rather than what the load holds. SDXL and SDXL-Turbo publish fp32 weights (12.9 GB) that load as 6.5 GB in bf16/fp16, so 20-24 GB cards planned whole-model offload for a model that fits resident, and a 16 GB unified-memory Mac refused it outright. Lumina-2 and Z-Image-Turbo ship fp32 shards the same way, and a cache holding fp16 variant twins, .bin twins or a single-file checkpoint beside the pipeline counted weights the loader never opens. Price each cached weight file the way from_pretrained materialises it: default-variant component files only, safetensors over a .bin twin, and a file whose floats are all wider than the load dtype at that dtype. Mixed precision, quantised and fp8 files, components whose class pins modules in fp32, and fp32 loads keep their stored size, and the estimate only ever lowers. Download sizes and disk checks are unchanged. * Studio: let the mirrored companion stub take the load itemsize * Studio: shorten the load-dtype sizing comments * Studio: widen half-precision weights on an fp32 load, keep a .bin the loader falls back to An fp32 target (a Mac without bf16, an fp16-incompatible family on an fp16 card) materialises bf16/fp16 shards at four bytes per element, so price every float at the load width there. A .bin is dropped only when its folder holds a safetensors checkpoint the loader can select: an unsharded file, or shards with their index. * Studio: honour Transformers' non-strict fp32 pins only on fp16 loads Transformers upcasts _keep_in_fp32_modules only when the load dtype is fp16 and _keep_in_fp32_modules_strict for both halves; Diffusers upcasts its set for both. A bf16 load of an fp32 T5 checkpoint is therefore priced at bf16. * Studio: price fp32-pinned modules at four bytes in half-precision loads A component whose class keeps modules in fp32 (T5's wo at fp16, a strict or Diffusers pin at either half) holds those tensors at four bytes whatever the checkpoint stores, so price them per tensor instead of leaving the file at its stored size. * Studio: match fp32 pins against the parameter path the way each loader does * Studio: price a surviving .bin checkpoint at the load dtype too * Studio: count a tied .bin weight once when pricing it * Studio: trim comments in the load-dtype memory plan * Studio: stop MiniMax-H3 recompiling on the second caption and the first i2v (#11880) * Studio: compile the prompt-length dims of Qwen-Image DiT blocks dynamic from the first render The max tier (and torchao weights on the default tier) compiles DiT blocks with automatic dynamic, so the first prompt's token count was compiled static and the first prompt of a different length recompiled every block graph into the generalised form it then kept (Qwen-Image-2.1: 14 s int8 default, 31 s bf16 max, 51 s int8 max; Qwen-Image: 52-57 s max). Name the block inputs whose size follows the prompt in torch.compiler.config.dynamic_sources, set only around the owning transformer's forward and restored even when it raises, so the first compile already builds the generalised graphs. The first segment start of Qwen-Image-2.1 stays static, which keeps clear of the torchao CantSplit that dynamic=True hits. The compile-cache key gains the allowlist only for these families. torch without the knob (2.6) is unchanged. * Studio: also mark Qwen-Image's text inputs dynamic when FBCache calls the blocks through hooks FBCache is on by default for Qwen-Image, and its hooks pass the block inputs as kwargs (or a resumed frame's stack after a graph break), so the plain L[...] names never matched and the second prompt length still recompiled. Suffix patterns cover those paths on torch 2.8+. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: ruff format * Arm the prompt-length allowlist only on torch 2.8+ torch 2.7 caches its first read of compiler.config.dynamic_sources for the life of the process, so scoping the list to one forward is either ignored or leaks it into every later compile. 2.8 re-reads it when it changes and adds regex matching (is_dynamic_source), which the FBCache hook paths also need. Older torch keeps today's behaviour. * Trim comments * Studio: compile MiniMax-H3's packed length dynamic from the first render A new caption changes H3's packed video + audio + caption length, and the first new caption after load recompiled the denoiser blocks (about 11 to 22 s). Name those inputs in the prompt-length allowlist so the first compile is already general, and keep the small-M int8 padding free of a branch on the row count when traced, which otherwise guarded the caption length to <= 31 rows and recompiled the refiner on the first i2v (a 540-row caption). * Pad traced rows with arithmetic max so a concrete row count still compiles torch.sym_max on a concrete int is rejected by dynamo on torch 2.8 and older, so a static compile of a padded int8 Linear broke (fullgraph drops the DiT to eager). builtin max() compiles but left an m <= pad_to guard behind on an inductor cache hit. (m + p + |m - p|) // 2 does neither. * Trim comments on the prompt-length allowlist * Trim comments on the H3 allowlist and traced row padding * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim dynamic text dims comments * Drop dead torch<2.1 hook fallback and redundant in-test skips * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten dynamic text dims docstrings --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Unsloth Studio / Desktop: log what an image load and each generation actually resolved to (#11994) * Studio: log what an image load and each generation actually resolved to * Studio: trim comments on the resolved and generation log lines * Studio: build the diffusion.loaded resolved field from the committed load state * Studio: log the applied denoise strength and native sd.cpp LoRAs in diffusion.generated * Studio: log the effective upscale factor, and only for the upscale workflow * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Unsloth Studio: stop offering "Continue" on a base repo that only holds a GGUF's text encoder and VAE (#11644) * Unsloth Studio: stop offering "Continue" on a base repo that only holds a GGUF's text encoder and VAE A companion-only snapshot stays partial so no picker loads it, but a new companion_prefetch flag keeps the Hub from presenting it as an unfinished download whose Continue pulls the denoiser the GGUF replaces. * Carry companion_prefetch through the local listing the Hub merges The Hub merges /api/hub/cached-models with /api/hub/local, and the local scanner knew nothing about companion-only snapshots. After a real GGUF load, its row for the base repo stayed Partial, and the detail pane still offered Continue at 33 GB. When the base repo held VAE and encoder shards, the same scanner classified it as a complete safetensors model instead, and the Hub offered Run on a pipeline with no denoiser. The local scanner now reads the same signal on the snapshot it lists: such rows are partial, as the cached listing marks them, and carry companion_prefetch. The frontend honours the flag on local rows too. * Keep a companion-only base repo out of model Discover's on-device and partial states buildDiscoverRows read partial and on-device straight off the cached or local row, so the new flag never reached the model Discover grid: the repo still read as a partial download there. * Show a companion-only base repo as a plain Download, not On device with Run Excluding the flag from the partial hf_cache branch sent the local row into the fully local view, which claims the repo is on device and offers Run on a pipeline with no denoiser. Keep the branch and clear only the partial state. * Key the Discover memo on the companion flag A companion fetch finishing leaves partial true on both listings and flips only companion_prefetch, so the signature the model Discover memo is keyed on did not change and the grid kept the repo as on device and partial. * Trim companion_prefetch comments * Keep Delete on a companion-only repo's download card The card gated its repo menu (Delete, path) on isDownloaded || isPartial, and a companion-only repo is now neither, so 19 GB of borrowed text encoder and VAE could no longer be deleted from the detail pane. * Drop the green On device dot from a companion-only inventory row * Trim comments --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Daniel Han <[email protected]> * Apply SFTConfig.router_aux_loss_coef to MoE models that cache it at init (#12006) * Apply SFTConfig.router_aux_loss_coef to MoE models that cache it at init * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten router_aux_loss_coef sync comments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Load only the language model for text_only on repo-code composites (#11861) * Load only the language model for text_only on repo-code composites FastModel.from_pretrained(text_only = True) skipped the vision tower only for families with their own text decoder (gemma3 -> gemma3_text). A repo-code composite such as Nemotron-3-Nano-Omni (llm_config + vision_config + sound_config, one wrapper class in auto_map) failed that test, so the whole wrapper was loaded and its forward required pixel_values. When trust_remote_code is set, the parent config is repo code, and every parameter of the text sub-config's causal LM (built on the meta device) is stored under exactly one checkpoint prefix, load that causal LM alone with a key_mapping stripping the prefix. Anything else keeps the previous full-model load, so no text weight can be left randomly initialised. * Also find the decoder of a repo-code composite under llm_config InternVL and Llama-Nemotron-Nano-VL keep the decoder config as llm_config without the text_config alias get_text_config() reads, so the text-only plan never saw it. Fall back to llm_config / language_config; the full-coverage checkpoint check still decides whether the branch is taken. * Keep the full-model load for repo-code composites on transformers 4.x transformers 4.x decides base-model vs task-model prefix handling from the checkpoint keys before key_mapping renames them, so a language_model. prefixed checkpoint either raises "state dictionary ... corrupted" or, with tied embeddings, loads every text weight as missing. Decline the text-only plan below 5.0 and skip the positive tests there. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Record the commit a trusted load ran repo code at A merged export that re-reads the repo's config with its code pins it to this commit instead of the branch head. Under text_only the model's config is the nested text config, which carries no commit, so the composite config's commit is taken before the remap. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pin the text-only config of a repo-code composite to the parent commit * Read a cached unsharded checkpoint when the text-only plan runs offline * Keep the full composite for adapters trained on it under text_only * Decline the text-only plan for repo-code composites under fast_inference * Accept sequence-valued auto_map entries in the text-only self-reference check * Rebase llm_int8_skip_modules once from the parent names for nested text prefixes * Pass torch_device to PeftModel.from_pretrained in the text-only adapter test * Probe sharded .bin composites for the text-only plan from their index * Pass local_files_only to the nested text class lookup of the text-only plan * Read adapter_model.bin names when deciding whether an adapter fits the text model * Probe the text-only plan at the commit its config was resolved at * Decline the text-only plan when the nested text class lives in another repository * Probe the text-only plan checkpoint under the requested subfolder * Keep the full composite for a device_map keyed on its module names * Probe the text-only plan checkpoint at the requested variant and cache_dir * Resolve the nested text class at the requested code_revision * Keep the full composite for an adapter on wrapper-only modules * Rebase the caller's quantization_config skip modules for the text-only plan * Stamp the code_revision commit as the trusted remote code commit * Stamp the rebased quantization_config on the text-only decoder * Save the text-only decoder under its standalone weight names * Pin the wrapper-only adapter test's PEFT load to the CPU * Give the text-only test namespace the remote class resolver resolve_model_class now calls * Trim comments in text-only remote composite loading * Add the license header to the text-only remote composite tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Try the text-only plan when a repo-code wrapper is its own text config (InternVL) * Rebase every quantization module-name list on the text model, and keep the full model for a regex that names the prefix * Detect a quantization regex that escapes any dot of a nested text prefix * Tighten comments in the text-only remote composite path --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Put back the unsloth_zoo modules the device map opt-in tests stub (#12038) * Studio: pass tool_result is_error through to the model on /v1/messages (#11962) Keep the Anthropic tool_result is_error flag on /v1/messages and mark failed tool output with an Error: prefix (or a short note when the output is empty) so the local model can tell a failed tool call from an empty success. * SentenceTransformer: add opt-in…
JoshuaL3000
pushed a commit
to JoshuaL3000/unsloth
that referenced
this pull request
Oct 4, 2026
unslothai#11016) * Lift the transformers ceiling to 5.17.0 and align the torch mirror transformers<=5.5.0 was the ceiling, and 5.5.0 is exactly where the prequantized bnb-4bit checkpoints lose quant_state on every Linear4bit (#9867, #10010, #10017, #10276): measured 352 of 352 on unsloth/Qwen3.8-27B-unsloth-bnb-4bit, with the reporters' own "mat1 and mat2 shapes cannot be multiplied (10x5120 and 1x15728640)" on the forward. On transformers 5.17.0 the same load is 0 of 352 and the forward returns logits. The ceiling also put the Gemma 4 E4B LoRA fix one patch release out of reach, since that shipped in 5.5.2 (#5355). Raise the cap at both pyproject sites, keeping every != exclusion, and move the CI lanes that mirrored it: - studio-backend-ci.yml installed 'transformers>=4.51,<5.5' in two jobs, which had drifted BELOW the published ceiling: it excludes 5.5.0, the release every user resolved. - notebooks-ci.yml installed '<5.6' while notebooks in unslothai/notebooks pin 5.10.1, 5.15.0 and 5.15.1, so the API surface it dumps came from a release those notebooks never run on. - studio-export-capability-ci.yml installed 'torch>=2.4,<2.13', which excludes the torch unsloth_zoo now admits. version-compat-ci.yml gets the two ends of the range it was missing. zoo-imports-under-spoof and grpo-fake-run each become a two-lane include matrix: a floor lane (py3.10, torch 2.6.0, transformers 4.57.6, TRL 0.22.2, PEFT 0.18.0) and a latest lane that pins nothing. A new torch-free cap-site-consistency job runs the window-drift assertions on ubuntu, windows and macos. tests/version_compat/test_transformers_pinned_symbols.py gains v5.15.0 through v5.17.0. Studio's single-env keeps transformers==5.5.0. That pin is not this cap: it is the version the pinned installer ships, locked in step with a tokenizers window transformers enforces at import, and widening only the darwin override reproduces the Apple Silicon failure its comment documents. The comment now says so. Evidence: the whole 4.57.6 plus 5.0 to 5.17 sweep, and a real 27B bnb-4bit load on both sides of the old ceiling. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Install torchcodec and hf_transfer where the two new lanes need them Both new version-compat lanes went red on their first run and both reasons are about what the lane installs, not about the cap. torchcodec carries a compiled extension linked against one libtorch build, and torch on these lanes comes from the CPU index. Listed in the package step it was taken from PyPI, where the wheel is the accelerator flavour, and next to a torch 2.14.0+cpu it cannot dlopen. unsloth then does what it is supposed to do and disables it, seating the sys.modules absence sentinel, after which datasets 5 answers any Dataset.from_dict with ModuleNotFoundError: No module named 'torchcodec.decoders'; 'torchcodec' is not a package and the GRPO lane fails during collection. Moving it back onto the torch install line, which is where it sat before this branch split the lanes, lets pip prefer the matching +cpu build. Verified in a clean venv: torch 2.14.0+cpu with torchcodec 0.16.0+cpu imports torchcodec.decoders and builds a Dataset, the same pair with PyPI torchcodec 0.16.0 is what CI hit. The floor lane's 0.2 row is not published on that index at all, so the extra index still serves it from PyPI. hf_transfer is a declared unsloth_zoo dependency and the zoo is installed here with --no-deps, so the lane has to supply it. unsloth sets HF_HUB_ENABLE_HF_TRANSFER=1 around from_pretrained, and the huggingface_hub 0.x that the floor lane's transformers 4.57.6 pulls raises instead of falling back when the package is absent, which took out 45 tests. * Keep the pip cache names literal in the two new matrix jobs tests/studio/test_pip_cache_naming.py reads the workflow as text and requires every pip-cache-restore name to be lowercase letters, digits and dashes, because it goes into the cache key verbatim and the janitor groups on it. The two new include matrices named the cache after the matrix slug, which the action itself would have accepted at run time but which fails that lint, and took the workflow-trigger lint job down with it. The per lane name was not needed anyway. The key already carries the interpreter, pip-v2-name-os-arch-pyMINOR-hash, and the two lanes are python 3.10 and 3.12, so they cannot overwrite each other's wheels. Both names are back to the literals they had before the split, with the reasoning written next to them and a note that two lanes sharing one python would need the job split instead. tests/studio/test_pip_cache_naming.py: 116 passed, and 1 failed 115 passed without this change. * Trigger the version-window drift job on every cap file it scans * Run the floor lane on the declared minima, and scope the pin exception to one requirement * Pin the GRPO floor lane to the declared TRL and transformers minima * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim the comments in the files this PR touches Delete-first pass over the changed files: collapse multi-line rationale to one line, drop measured numbers, section banners, spacer lines and restatements of the code. Comments, docstrings and whitespace only, AST gated; no behaviour change. * Trim the export-capability workflow comments too * Read the transformers compat matrix from PyPI instead of pinning it This suite exists to say which versions the cap may be lifted to, so a hand-maintained tag list answers for the day it was edited. It now takes every minor at or above the 4.57.6 floor, latest patch of each, the same way tests/vllm_compat does for vLLM. One tag per minor keeps the matrix bounded as upstream keeps releasing. A patch that broke something specific earns its place in _ALWAYS rather than a blanket every-patch sweep: 5.5.0 is the old ceiling and still the Apple Silicon cap, 5.16.0 first required tokenizers>=0.23.1. Yanked, rc, dev and post releases are skipped, since pip will not install them. _TAG_OVERRIDES carries the one place upstream disagrees with itself: PyPI 5.10.4 is tagged v5.10.3. A frozen fallback list covers an unreachable PyPI, so a network failure cannot quietly shrink the matrix to nothing and report green. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep the load bearing tags when PyPI cannot be read * Anchor the matrix to the ceiling pyproject declares * Resolve the matrix once so every xdist worker collects the same one * Anchor the patch releases the notebooks pin * Import the declared ceiling, and let the unpinned lane be a canary * Give the ceiling lane its own pip cache key * Anchor the shared matrix too, and derive the ceiling tag through the override table * Split the PyPI-tracking matrix out of the cap lift The dynamic matrix, its anchors and the CI lane restructure move to their own PR. This branch keeps the cap lift, the four cap sites, the drift gate and a static tag list that covers the window the cap opens: 4.57.6 and every 5.x minor through the declared ceiling v5.17.0, plus the v5.10.1 and v5.15.1 pins several notebooks carry. * Raise the transformers floor to 4.52.4, which is the oldest one that imports The declared floor was transformers>=4.51.3 beside peft>=0.18.0, and that pair cannot import: peft declares no transformers floor of its own, and peft 0.18.0 imports GradientCheckpointingLayer from transformers.modeling_layers at peft/tuners/lora/model.py:26, a module that first exists in transformers 4.52.0. pip resolved it happily and import unsloth then raised ModuleNotFoundError. 4.52.4 rather than 4.52.0 because 4.52.0 through 4.52.3 were already rejected by name; those exclusions are now dominated by the floor and drop out. Measured, not inferred: the floor lane's import set was run at 4.51.3 (5 failed, 21 passed, matching CI exactly), 4.52.0, 4.52.4, 4.53.1 and 4.54.1 (34 passed each), so modeling_layers was the only missing piece. tests/test_transformers_cap_sites.py grows the mirror of its ceiling gate: TESTED_FLOOR, a check that both version-compat floor lanes pin the declared floor, and a negative control that the window still refuses 4.51.3. test_trl_loss_normalization_contract.py checked DPO with hasattr, which has been false since trl 0.21 declared loss_type with a default_factory, so that half was skipped on recent TRL and wrong at the floor. DPO and KTO are now compared to pristine TRL, whose values are version-dependent, while GRPO stays the literal bnpo that rl.py deliberately pins. * Let the TRL floor lane's training tests run at the declared floor The lane's two loaders passed dtype = torch.float32 to from_pretrained. That kwarg is rejected at the transformers 4.52.4 floor, where from_pretrained forwards it into the model constructor, so 45 tests died with TypeError: LlamaForCausalLM.__init__() got an unexpected keyword argument 'dtype' the moment the lane could import at all. torch_dtype spans the window but is deprecated from 4.57.6 on, so neither literal is safe: load with neither kwarg and cast after, asserting the parameter dtype really is float32 so the cast cannot silently no-op. tests/version_compat/test_no_dtype_kwarg_at_load.py keeps it that way, an AST scan of every test in the directory for a dtype or torch_dtype kwarg on from_pretrained, with five parametrised controls including a dtype kwarg that is not a load at all. test_pristine_trl_config_without_max_seq_length_still_truncates asserted a precondition it cannot control: the regression only exists on a TRL that dropped max_seq_length, and trl 0.18.2 still declares it. It skips with that reason now, the same way the file already skips an unreachable hub. * Add the call-site guard that keeps a dtype kwarg out of these loaders An AST scan of tests/version_compat for a dtype or torch_dtype kwarg on from_pretrained. Neither spelling holds across the declared transformers window: dtype raises TypeError at the 4.52.4 floor and torch_dtype is deprecated from 4.57.6 on, so the durable rule is to load without either and cast the result. Five parametrised controls, including a dtype kwarg that is not a load. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Require the unsloth_zoo release that carries the same transformers ceiling pip intersects unsloth's transformers window with unsloth_zoo's own, and published unsloth_zoo 2026.9.4 still says transformers<=5.5.0, which is exactly the cap this PR lifts. Without a matching zoo floor the lift is advertised and not delivered. Move the declared zoo floor to the first release expected to carry the lift and add a gate: with the floor back at 2026.9.4 the new test fails, naming the intersection. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Read the tightest upper bound, and keep the exemption list honest _ceiling took max over the upper bounds, so raising a cap by adding a bound without removing the old one (<=5.17.0,<=5.18.0) reported 5.18.0 while pip still resolved at 5.17.0. Take the tightest bound instead, with < beating <= at equal versions. PINNED_BY_DESIGN carried a placeholder for a requirement no lane spells. That is not documentation, it pre-authorises that exact string: reintroduce transformers<=5.5.0 in that workflow and the scan finds it and then skips it. The dict is empty now, and a new test requires every entry to match a requirement a lane really spells today. * Hold the unsloth_zoo floor at 2026.9.4 until the matching release ships unsloth_zoo 2026.9.5 does not exist on PyPI; 2026.9.4 is the newest published release. `unsloth_zoo>=2026.9.5` is therefore a floor no release satisfies, which makes unsloth uninstallable rather than merely under-delivering the lifted transformers window, and it blocks this PR. Revert the three pyproject sites to 2026.9.4, which is what main carries, and rewrite the comment above the floor so it no longer contradicts the pin: it now says the floor is held here and names what still needs the newer zoo. The gate that asserts the floor is deferred rather than deleted, so it stays the reminder to raise the pin later. ZOO_FLOOR_WITH_LIFTED_TRANSFORMERS_CAP is None, the test skips with a reason naming unslothai/unsloth-zoo#1227, and setting the constant to the release that ships #1227 re-enables it in one edit. The half of that gate that does not depend on which release the floor names, that there is exactly one zoo floor and that it is a real lower bound, still holds at 2026.9.4 and is split out into test_pyproject_declares_one_unsloth_zoo_floor, which keeps running. Known and accepted while this stands: pyproject advertises transformers up to 5.17.0 while the resolvable zoo still caps it at 5.5.0, so the lift is declared but not yet delivered. * Track PyPI for the transformers compat matrix (#11136) The static tag list answers for the day it was edited. This reads the releases from PyPI, keeps one tag per minor to stay bounded, and merges the anchors no automatic rule can derive: the floor, the old Apple Silicon ceiling, the tokenizers breakpoint, the patch releases the notebooks pin, and the ceiling pyproject itself declares. Six failure modes found in review, each with a named test and each mutation proven: a fallback that dropped the anchors, a ceiling anchored to a literal, xdist workers collecting different matrices, a later patch evicting a pinned one, two CI lanes minting one pip cache key, and the shared matrix file bypassing the anchor merge. The CI lane restructure comes with it, since the matrix is what it feeds: floor, ceiling and latest on three interpreters and so three cache keys, with latest marked non-blocking because resolving outside the declared window is its job. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Raise the unsloth_zoo floor to 2026.9.5 Main moved to 2026.9.5 in #11210, so this branch's 2026.9.4 was a regression against main. 2026.9.5 also settles the second of the two reasons the floor was tracked: it carries the generated-sentinel fix (unslothai/unsloth-zoo#1259). The transformers half stays outstanding, since 2026.9.5 still declares transformers<=5.5.0 pending unslothai/unsloth-zoo#1227. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make the zoo deferral expire by itself instead of on a hand-written constant Codex raised (P1) that `unsloth_zoo>=2026.9.5` still admits a zoo whose own metadata says `transformers<=5.5.0`, so pip intersects the widened range back down and users keep resolving 5.5.0. That is correct, and it is measured: enumerating all 230 published transformers releases, this branch widens the unsloth side by 26 cells, but the range a user actually resolves (ours intersected with published unsloth_zoo 2026.9.5) moves by 0 newly admitted cells. 229 of 230 cells are identical and the one that moves is 4.51.3 becoming rejected, which is the floor fix. The requested remedy cannot be applied here. Raising the unsloth_zoo floor to the release carrying unslothai/unsloth-zoo#1227 requires that release to exist, and it does not; a floor no published release satisfies makes unsloth uninstallable, which is why the floor never leads the release. That reasoning is already in the comment above the floor and in the deferred gate's docstring. What was genuinely wrong is the shape of the deferral. `test_the_declared_zoo_floor_can_supply_the_declared_transformers_window` skips while `ZOO_FLOOR_WITH_LIFTED_TRANSFORMERS_CAP` is None, and that constant is hand-written, so on the day #1227 ships nothing turns red: the gate keeps skipping and the floor keeps naming a zoo that caps at 5.5.0 for as long as nobody looks. That is "a site left behind after the window moves does not go red", which is the failure this whole file exists to catch, reproduced inside its own deferral. `test_the_zoo_deferral_expires_when_the_zoo_release_ships` closes it. It asks PyPI what the newest published unsloth_zoo allows and fails only on POSITIVE evidence that the deferral is obsolete, naming the release to pin and the constant to set. No network, a timeout, a malformed answer or a zoo with no readable ceiling all leave it skipped, so it can never go red by failing to reach PyPI. That preserves the property that put this suite on the three-OS cap-site job: offline runs stay honest. Verified in all three directions rather than by reading: shipped zoo (2026.10.1 admitting 5.17.0) -> fails, message names the release PyPI unreachable -> Skipped, never a failure live PyPI today -> zoo 2026.9.5 caps 5.5.0 < declared 5.17.0, so the deferral correctly stands Suite is 25 passed, 1 skipped. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Start the symbol matrix at the declared floor, and anchor the release with no tag Codex raised (P2) that `_FLOOR` was a literal 4.57.6 while this PR moves the declared floor to 4.52.4, so `_release_tags()` discarded every 4.52 through 4.56 release and the matrix could stay green while a source-pattern or symbol dependency broke supported users. Confirmed: the floor was the only hardcoded end of the window in this file, since the ceiling is already read from pyproject through `_CAP` for exactly this reason. `_FLOOR` is now derived the same way, by `_declared_floor()`, taking the LOWEST `>=` in the file so a marker-gated half declaring a higher floor cannot raise it and hide releases the other half still admits. A bad read falls back to 4.52.4 rather than widening the matrix to every release ever published. Widening it turned up a real defect, which is the point of having done it. On the first run 4.54.1 failed five checks, all on the fetch rather than on a symbol: v4.54.1: src/transformers/trainer[.py|/__init__.py] both missing 4.54.1 is on PyPI and inside the window, but upstream never pushed a v4.54.1 tag. The only 4.54 refs are v4.54.0 and v4.54-release. Checked directly rather than assumed: v4.54.1 tag ref HTTP 404 v4.54.0 __init__ __version__ 4.54.0 (so it is NOT this release) v4.54-release __version__ 4.54.1 (trainer.py HTTP 200) so the entry is `"4.54.1": "v4.54-release"`, the same shape as the existing 5.10.4 entry and for the same documented reason. `_sort_key` now resolves a tag back through the override table before parsing it, since a tag whose name is not a version string has to sort by the release it carries. With both changes the matrix runs 4.52.4 through the ceiling: 523 passed, 9 skipped, against 506 passed, 21 skipped and 5 failed when the floor was widened alone. `test_the_matrix_starts_at_the_declared_floor` keeps it from drifting back. Mutation proven: restoring the 4.57.6 literal turns it red on 23 of 28 tags, and the restored tree is 28 passed. * Start the outage fallback at the declared floor too Codex raised (P2) that deriving `_FLOOR` fixed only the live path: `_TAGS_FALLBACK` is a separate frozen list and still began at v4.57.6, so any PyPI failure dropped every 4.52 through 4.56 check and CI could go green straight through a regression at the low end this PR newly supports. Correct, and it is the same defect as the one just fixed, one code path over. `_ALWAYS` does not cover it either: those anchors are the Apple Silicon ceiling and the tokenizers breakpoint, both 5.x. The fallback now starts at the declared floor, one tag per supported minor below the old start: v4.52.4, v4.53.3, v4.54-release, v4.55.4, v4.56.2. 4.54 goes in under its real tag for the reason `_TAG_OVERRIDES` already records. `test_the_outage_fallback_reaches_the_declared_floor` holds it there under a simulated outage, asserting both that the oldest tag reached is at or below the declared floor and that no supported minor between 4.52 and 4.56 is missing, so restoring one tag while dropping the rest does not pass. Mutation proven: putting the fallback back to a v4.57.6 start turns it red, restored is 2 passed. Full suites 577 passed, 10 skipped. * Keep the ceiling lane inside the declared datasets window, and compare zoo bounds by membership Two P2 items from the last review, both genuine. The ceiling lane installed `datasets` bare. Both checkout installs in that job use --no-deps, so pyproject's `datasets>=3.4.1,!=4.0.*,!=4.1.0,<4.4.0` never reaches the resolver and the bare name takes the newest release, which is datasets 5 today. A blocking lane whose purpose is to isolate compatibility with the transformers ceiling would instead fail on a datasets release the project does not support. It now carries the declared window verbatim, as the floor lane already does. The `latest` lane stays bare on purpose: resolving outside the window is that lane's entire job. The second is a bug in the deferral-expiry check added earlier in this PR. `_newest_published_zoo_transformers_ceiling` recorded `<` and `<=` alike as a bare ceiling Version, so a future zoo declaring `transformers<5.17.0` would have been read as covering this project's `<=5.17.0` window and expired the deferral on a release that still cannot resolve our ceiling. It now keeps whole SpecifierSets and asks whether the declared ceiling is a MEMBER of the published zoo's window, which is the actual question. Verified both directions against the case named in the review: zoo `>=4.52.4,<5.17.0` -> deferral correctly STANDS, no false expiry zoo `>=4.52.4,<=5.17.0` -> correctly fails, naming the release to pin Suites are 577 passed, 10 skipped. * Let the GRPO left-pad probe resolve at the declared TRL floor The injected probe tried has_images and fell back to images with no third branch. TRL 0.18.2 and 0.19.1 bind neither name in _generate_and_score_completions and have no vision path at all, so the fallback raised NameError out of the except handler and took GRPO training down at the bottom of the declared window. 0.20.0 through 0.23.1 bind has_images, 0.24.0 and up bind images. Resolve a text-only flag through all three cases, then compute the pad once. tests/version_compat/test_grpo_left_pad_probe_at_the_floor.py executes the rewritten function against each binding shape and re-derives the table from upstream sources, and is wired into both GRPO fake-run lanes. Also names tests/version_compat/test_no_dtype_kwarg_at_load.py in the pinned-symbol matrix, which is what test_version_compat_bundle.py asks of every suite that exists. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Resolve the GRPO importance sampling level at the declared TRL floor The rewritten compute_loss read self.importance_sampling_level unconditionally and passed it to both the no-grad and the gradient loss path. That attribute is GSPO's and arrived in TRL 0.20.0, as a GRPOConfig field the trainer copies onto itself. 0.18.2 and 0.19.1 have neither the field nor the attribute, so GRPO training died in the first training_step at the bottom of the declared window: AttributeError: 'UnslothGRPOTrainer' object has no attribute 'importance_sampling_level' Read off upstream rather than inferred: grpo_trainer.py binds self.importance_sampling_level 0 times at 0.18.2 and 0.19.1, and 5 or more from 0.20.0 on, with grpo_config.py matching. Resolve through the trainer attribute, then the config field, then 'token'. The fallback is not invented: 'token' is the default TRL's own field declares, it is what unsloth_zoo's grpo_compute_loss already defaults to, and 0.18.2 has no sequence level path at all. Versions that bind the attribute are unaffected, since it is found first. tests/version_compat/test_grpo_importance_sampling_level_at_the_floor.py execs the real rewritten source and captures the level the loss actually receives, over both loss paths and all three binding shapes, and re-derives the upstream table so a future TRL that moves the knob fails here rather than in a training loop. Mutation checked: reverting either call site turns 4 of 7 red, and the 3 that stay green are the arms the bug never touched. Second of this family, after the left-pad probe. Same shape: injected source assuming a TRL binding the floor does not have. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Supply the Docker Hub credential the way the workflow now takes it Both harnesses handed the step its key by replacing `${{ secrets.DOCKER_API_KEY }}` in the `run:` body. The key has since moved into the step's `env:` block so it is never a command-line argument, which means that replace matches nothing: the body builder died with KeyError, curl was handed an empty request, and the step still exited 0 because the failure was inside a pipeline. The stub also logged only "$*", and the auth body is passed on stdin via `--data-binary @-`, so the identifier could not be observed even when it was sent. The harnesses now set DOCKER_API_KEY in the environment and the stub appends the stdin body to the log, only when curl was actually told to read stdin. Both halves are load-bearing: removing either one fails the assertion again. The workflows themselves are correct and unchanged; an empty token is caught by their own `-z "$TOKEN"` check. This was the test harness drifting behind them. A new test in each file pins that the step takes DOCKER_API_KEY from `env:` and keeps no `${{ }}` in its body, so a rename fails loudly instead of quietly returning these assertions to describing an empty request. * Cut the comments in the files this PR authors Opening comment-reduction pass over the five files this PR writes in full or near enough. 422 comment lines to 342 across them, 26.9 percent to 23.0. Long rationales collapse to the one fact that is not recoverable from the code: the version tables, the traps each constant exists to avoid, and the citations. Tracebacks and narration go, since the PR description carries them. Files the PR barely touches are left alone. rl_replacements.py changes 27 lines of 3658 and test_trl_padding_free_max_length.py 21 of 3678; rewriting their comments would grow the diff well past what a dependency cap lift should contain. Comment-only, AST-verified with comment_tools.py check: 5/5 code unchanged. * Second comment sweep: delete the restating summary lines Sweep one shortened, this one deletes. Each remaining paragraph docstring loses the summary line that restated the test name, keeping the fact the name does not carry. 342 comment lines to 301 across the files this PR authors, 23.0 percent to 20.5; from 422 at the start of the pass. Not taken to the 15 percent target: what is left is version tables, the trap each constant exists to avoid, and issue citations, and cutting those is the one outcome worth avoiding. Comment-only, AST-verified with comment_tools.py check. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Skip the GRPO floor suites off-runner instead of erroring collection Both files import the real rewriter, so unlike the cap-site suites they cannot be file-only. On a runner without torch `import unsloth` raises its own ImportError("Unsloth: torch not found"), and a bare module-scope import turns that into a COLLECTION ERROR: the cross-platform staging run was red on ubuntu, macos and windows for exactly this, having tested nothing. pytest.importorskip does NOT cover this case, which is worth writing down because it is the obvious first fix and it does not work: it skips a module that is ABSENT and re-raises an ImportError the module body raised itself, which is precisely what unsloth does here. Verified against a stub package that raises ImportError on import: importorskip still ends in "1 error during collection", the try/except ends in "1 skipped". Both directions checked on the real files: with torch present all 13 tests run, and against a stub unsloth that raises, both modules skip and the run exits clean. * Lift the TRL ceiling to 1.13.0 and gate the range that was already being tested (#11137) * Keep more VRAM headroom on Windows CUDA, and say when a hand-set context does not fit (#11368) * Stop a Windows host-RAM spill from looking like a healthy load On Windows, cudaMalloc does not allocate device memory directly. It asks the WDDM kernel memory manager, which treats VRAM and system RAM as one demand paged pool, and since driver 536.40 an allocation past the end of VRAM succeeds out of host RAM instead of returning out of memory. The load starts, exits 0, answers /health, and nvidia-smi shows a healthy card, while decode re-reads the spilled bytes over PCIe on every token. Linux has no such path. The same allocation fails with "cudaMalloc failed: out of memory" and llama-server exits, which is measurable: with 12 GiB free, Qwen3-VL-8B at -c 65536 asks for 9216.00 MiB in one allocation and refuses to start. That is why every rung of the spawn loop's recovery ladder is gated on a non-zero exit code, and why the whole ladder is dead on the one platform that needs it. Three changes: Raise the per-device reserve to 1024 MiB on Windows with a discrete CUDA build, capped at an eighth of the card so it stays proportionate on small GPUs. This is not a new magic number, it is the per-device margin llama.cpp's own fitter keeps when nobody tells it otherwise, and where our estimate carries all the risk we should be at least as conservative as the child would have been. Linux and macOS budgets are unchanged, and the monotonicity property in _vram_reserve_floor_mib still holds at every fraction. After a full GPU pin comes up healthy, check that the load is actually resident. Windows exposes the spilled bytes itself through the '\GPU Adapter Memory(*)\Shared Usage' counter behind Task Manager's shared memory figure, which nvidia-smi cannot see because on WDDM it reports dedicated VRAM only. That counter is per adapter rather than per process, so it is believed only when the device side independently shows the child short of the weights plus KV cache that full offload must place on the card. Report only, no recovery. Warn when a hand-set context does not fit. The planner already prices this correctly and already hands the load to --fit, but said nothing about why the context was flexed. The notice also re-prices at q8_0 and mentions it when that would make the configuration fit, rather than changing a user's cache dtype for them. Refs #11349, #11336 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim comments in the Windows sysmem fallback change * Keep the residency check and context notice from making false claims The residency check read only -ngl and --fit, so a user extra appended after the pin that keeps weights or the KV cache on the host (--cpu-moe, -ot, -ncmoe, -nkvo, --device none, or their LLAMA_ARG_ env twins) was reported as a host RAM spill. The =-form overrides (--gpu-layers=10, --fit=on) were missed the same way. The overcommit notice offered the Auto fallback anchor as the largest context that fits when the weights alone overflow every GPU subset, so lowering the context to that figure would still not fit. Only offer a context when one fits. * Scope the residency check to CUDA builds, the loaded adapter and its own process Arm only when the resolved build is CUDA: a Vulkan launch on an NVIDIA host has no CUDA sysmem fallback and its ordinals are not NVML indices. Read Dedicated Usage beside Shared Usage and count shared growth only on the adapters whose VRAM grew across the spawn, so a display iGPU's churn on an Optimus laptop is no longer booked as the model's spill. Hand the verifier thread a snapshot of the armed state and the child it was started for, and drop its result if that child has since been replaced. * Check residency before the load returns, and keep its advice accurate Run the residency check synchronously once the final child is ready, after every post-health respawn, so the verdict describes the process that is actually serving and reaches the load response. A warning written after the response was never shown. The spill notice is appended to an earlier one instead of losing first-notice-wins. Offer q8_0 only when the cache is still f16, cap the counted adapters at the number of pinned cards, key the sysmem-fallback cache by the resolved binary, and use the Windows wording in the context notice only for CUDA builds. * Gate the direct spill signal on a full card, and settle before re-baselining The measured delta carries the CUDA context and compute buffers, so requiring it to fall short of the weights+KV floor masked small spills such as the 74 MiB case. WDDM only spills once dedicated VRAM is exhausted, so count shared growth when a pinned card is nearly full instead. Wait for a killed retry child's VRAM to settle before sampling the next baseline, and price the q8_0 hint's compute scratch at q8_0. * Report the measured spill, judge a full card by its own reserve, drop a stale notice Name the counter's measured shared-memory growth as the spill amount on a direct hit; the floor delta can be negative there, since it carries the CUDA context and compute buffers. Treat a card as full below its proportional sysmem-fallback reserve rather than a flat 1 GiB, so small cards are not flagged. Publish the context overcommit notice only when the final plan still hands the load to --fit on, since slot reduction can re-pin it. * Word the context notice for planned offload, and tighten the spill report The overcommit notice fires only once the load was handed to --fit on or a spill plan, both of which place host tensors deliberately, so the Windows driver-fallback wording and NVIDIA setting never applied there. Use the CPU offload wording on every OS. Sum only positive shared growth across pinned adapters, report spills under 1 GiB in MiB instead of rounding them to 0.0 GB, and key the fallback classification by build revision so an in-place runtime update is re-read. * Disarm the residency check on a KV layout change, skip the notice under -nkvo A retry that respawns with a different slot count or unified-KV setting holds a different cache than the floor was priced for, so disarm instead of comparing against the stale floor. With KV offload disabled the cache stays on the host, so the context overcommit priced from GPU KV bytes is not real. * Do not cache an empty backend scan _installed_ggml_backends returns an empty set for an unreadable lib dir instead of raising, so the transient-failure rule has to cover that result too. Also let the residency tests import their sibling harness when run on their own. * Keep host-only tensors out of the residency floor, and tighten the notices Subtract an untied token_embd (kept on the CPU at full offload) and MTP blocks that do not load from the floor, by the same rules _unified_need_now uses, so a healthy load is not flagged as a spill. Skip the context notice when the user placed tensors on the CPU or fixed the layer count, offer q8_0 only when flash attention is planned on, and name the executable actually launched in the driver-setting advice. * Trim comments added during review * Drop the post-load residency check; keep the Windows reserve and the context notice The spill detector could not be validated on Windows NVIDIA hardware and was most of this change's size and risk. Keep the two parts that stand on their own: the raised sysmem-fallback reserve on Windows CUDA builds, and the advisory when a hand-set context does not fit. The backend classifier tests move to the reserve's test file. * Skip the context notice for an env-fixed layer count or at the native ceiling An inherited LLAMA_ARG_N_GPU_LAYERS is a deliberate placement like the argv flags. When the ceiling sweep stopped at the native context, a larger rope- scaled window was never searched, so the largest context that fits is unknown. * Skip the context notice when the user turns the fitter off User extras follow the generated --fit on, so a trailing --fit off disables the fitter and nothing moves layers to the CPU; the notice would claim otherwise. * Register the q8_0 what-if in the split-rate call-site guard * Trim comments in the Windows reserve change --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Unsloth Studio (AMD): keep export off a GPU PyTorch has no kernels for, like the iGPU (#11946) * Studio: keep export off a GPU the installed PyTorch has no kernels for * Trim comments restating the code * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Read the hot-path I/O cost at its steady minimum across repeats (#12029) * Unsloth Studio: a companion fetch with no denoiser no longer blocks deleting its base (#11828) A cached repo counts as needing a companion base only if it holds a runnable denoiser. The VAE-only fetch the native engine leaves in unsloth/Qwen-Image-2.1-FP8, and the default pre-cast fp8 text encoder a diffusers load caches at that repo's root, no longer pin Qwen/Qwen-Image-2.1 from a row the On Device list cannot act on. A prequant repo holding its DiT checkpoint still pins its base. Fixes #11825. * Studio: stop Python tool network calls from skipping the host allowlist (#11172) * Studio: check the sandbox host allowlist for keyword, variable and aliased hosts in Python network calls * Drop two sandbox comments that restate the code below them * Keep resolving a network alias when the name is rebound elsewhere * Rank network alias stores by the call they reach and ask on depth exhaustion * Refuse a network target that is out of policy on any competing store * Check a connect receiver that is a tracked client on any path * Keep a valueless store unresolved instead of dropping it * Read class-body names in source order and match only urllib3 calls that connect * Check every candidate signature and scope attribute receivers to their owner * Check the proxy and pool entry points urllib3 exports * Carry unpacked values to the target they bind * Memoize alias resolution so a branching chain stays linear * Ask when alias resolution gives up on the callee * Expand conditionals so every branch of a target is checked * Let an unconditional rebinding replace the value a later read sees * Check session and pool request methods, and only supersede on a certain binding * Keep the enclosing binding when a class store may not run * Take each client method's URL position from its real signature * Check client base URLs, parameter defaults and self-referential stores * Resolve prebuilt requests and check explicit proxy destinations * Cover OPTIONS and the modules these APIs are actually defined in * Resolve a client kept on an attribute * Follow base classes, cover session uploads and websockets, drop the quadratic scan * Make a binding take effect at the end of its statement * Resolve a walrus callee to the callable it assigns * Apply the literal-target fallback only to listed entry points * Only read a call result as its constructor when that names a known client * Cover raw urllib3 connections, renamed receivers and disabled proxies * Treat the lowercase session factory and aiohttp's request helper as entry points * Resolve constant getattr dispatch and cover aiohttp uploads * Check the payload where a request is built * Bind a definition name after its header runs * Keep the stores that resolved when a sibling store hits a cycle * Resolve a connect receiver with the same resolver as every other callee * Put a client's connect in the target table and stop reading stores that have not run * Generate the urllib3 URL factory specs from the module that defines each * Keep source order inside the body that does the reading * Check the encoded pool helpers and a proxy set on the session * Give attribute stores the same reaching rule as name stores * Tie a receiver's attributes to the binding in effect at the call * Parse the URL the client will send, and follow a mutated proxy mapping * Sequence a finally block with the statements that follow the try * Key attribute stores on the whole receiver path * Read attribute stores under the dotted paths they are recorded with * Port client, proxy and SSH egress coverage onto the alias screen from main * Trim comments on the ported egress tables * Track annotated assignments, share proxies across client copies, skip static methods * Treat local client subclasses as the client, and follow aliased proxy mappings * Read base_url stores on a client and in-place proxy merges * Scope client destination attributes to the client that reads them, and cover asyncssh.connection * Resolve network submodule paths to the names their package re-exports * Read a proxy without a scheme as a host * Skip mapping keys and None destinations * Skip no_proxy entries in proxy mappings * Screen uploads through httpx stream, and follow clients passed to local functions * Track subclasses of connecting classes, and read httpx transport proxies * Follow clients passed to local methods * Propagate clients along every recorded copy, and bind unbound method calls * Track clients bound by loop and comprehension targets * Follow clients returned by local factories, and link helper parameters to their callers * Follow factory methods and awaited factories * Follow aliases of local functions * Read class-body clients in their own body, and read authority-relative URLs * Screen PoolManager.connection_from_host * Bind calls and index flows after every alias is collected * Tighten comments on the egress screen additions * Screen datagram destinations on sendto and sendmsg * Apply proxy stores after binding, and read proxy environment variables * Resolve os and environ aliases for proxy environment stores * Screen urllib openers and ProxyHandler mappings * Follow wrapper instances, read environment mappings, and scope environment proxies * Reach inherited client methods through self, and read expanded environment updates * Read mutated environment mappings and os.environ merges, and honour aiohttp trust_env * Resolve environment keys held in variables, and bind local constructor arguments * Treat lambdas bound to a name as local functions * Handle annotated assignments through the same binding path as plain ones * Follow inherited initializers, inline wrappers, environ aliases and super() * Carry os.environ through helper parameters * Check asyncssh tunnel and proxy_command, and honour httpx trust_env=False * Treat a paramiko sock argument as unreadable * Screen asyncssh.connect_reverse, and follow clients returned by properties * Carry the os module through assignments and helper parameters * Check SSH routing keywords from one table, including Fabric gateway * Limit the sock routing rule to SSHClient.connect * Check asyncssh connection options, and read named proxy mappings * Follow bound local methods saved under another name * Track proxy-manager factories and SOCKSProxyManager as pool clients * Read a path with a relative literal prefix as hostless * Read a wholesale os.environ replacement * Trim comments in the egress screen additions * Index shadowed names by scope so the egress screen stays linear on class-heavy code * Read a backslash as the end of the host, and follow class attributes and unpacked factory tuples * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Read proxy writes through os.environb, and fail closed on a Fabric connect_kwargs sock * Never trust a host with a backslash, and read filled-in Fabric kwargs and getattr environ writes * Check positional SSH route arguments for paramiko connect and Fabric Connection * Read an explicit environ __ior__ call like update * Trim comments in the egress screen fixes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Maheswar Kumar <[email protected]> Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Studio: center collapsed sidebar icons and tighten the rail (#12031) * Studio: center collapsed sidebar icons and tighten the rail The nav icon's expanded-row nudge also applied in the collapsed rail, leaving each icon 2px right of its hover circle. Drop it there, use 30px round hover targets throughout the rail (including the open sidebar toggle), and sit the settings cog one nav row above the avatar. * Studio: shrink collapsed sidebar hover circles to 28px * Unsloth Studio: list a GGUF with no header metadata under On Device on the Images page (#11830) * Studio Hub: classify a GGUF whose header names no architecture from its name unsloth/Qwen-Image-2.1-GGUF files carry no general.* keys at all, so _arch_to_task answered None. The Images picker filters On Device rows on an exact task and dropped the row; the unfiltered Chat picker listed it and refused it. A readable header that names nothing now takes the same name-only route as a cloud placeholder. * Trim comments on the no-architecture GGUF classification * Keep the MiniMax-H3 conditioner out of the name-only video route --------- Co-authored-by: Daniel Han <[email protected]> * Keep the conversion backfill's donor stub off the transformers package (#12034) * Unsloth Desktop: show Stopping… after Stop so a pending cancel doesn't look ignored (#11976) * Studio: show Stopping… after Stop so a pending cancel doesn't look ignored * Studio: tighten stop-label comments --------- Co-authored-by: Daniel Han <[email protected]> * Studio: stop edit_file writing a compacted-argument placeholder into files (#11950) * Studio: stop edit_file writing a compacted-argument placeholder into files * Trim comments in the compaction receipt guard --------- Co-authored-by: Daniel Han <[email protected]> * Studio: decode Wan video in fp16 with channels_last_3d convs (#11999) * Studio: decode the Wan video VAE in fp16 with channels_last_3d convs * Format * Trim the fp16 decode docstring * Trim fp16 decode comments * Unsloth Studio: refuse picking a hosted FP8/INT8 checkpoint repo as a pipeline before it downloads (#11829) * Studio: refuse a pipeline pick of a hosted prequant repo before it stages anything A pick of unsloth/Qwen-Image-2.1-FP8 with no file name is a pipeline load, and validate_load_request let it through: the family detects from the id and unsloth/ clears the trust gate. The plan staged the repo's 14 GB of checkpoints, then from_pretrained 404d on the model_index.json the repo does not have. The hosted prequant repos are now a table (prequant_only_repo_ids) and a pipeline pick of one is refused with the base repo and precision to pick instead. * Skip the hosted prequant-repo pipeline refusal when repo_id is an existing local path - The new prequant-repo pipeline refusal matched the repo id by exact string, so a local pipeline directory cloned to that same relative name (e.g. ./unsloth/Qwen-Image-2.1-FP8 with a valid model_index.json) was wrongly rejected. It now skips the refusal for local paths and lets the existing local manifest validation handle them. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: trim comments in prequant pipeline-pick refusal --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: danielhanchen <[email protected]> * Studio: stop the second prompt length recompiling Qwen-Image on the max tier and with int8 (#11842) * Studio: compile the prompt-length dims of Qwen-Image DiT blocks dynamic from the first render The max tier (and torchao weights on the default tier) compiles DiT blocks with automatic dynamic, so the first prompt's token count was compiled static and the first prompt of a different length recompiled every block graph into the generalised form it then kept (Qwen-Image-2.1: 14 s int8 default, 31 s bf16 max, 51 s int8 max; Qwen-Image: 52-57 s max). Name the block inputs whose size follows the prompt in torch.compiler.config.dynamic_sources, set only around the owning transformer's forward and restored even when it raises, so the first compile already builds the generalised graphs. The first segment start of Qwen-Image-2.1 stays static, which keeps clear of the torchao CantSplit that dynamic=True hits. The compile-cache key gains the allowlist only for these families. torch without the knob (2.6) is unchanged. * Studio: also mark Qwen-Image's text inputs dynamic when FBCache calls the blocks through hooks FBCache is on by default for Qwen-Image, and its hooks pass the block inputs as kwargs (or a resumed frame's stack after a graph break), so the plain L[...] names never matched and the second prompt length still recompiled. Suffix patterns cover those paths on torch 2.8+. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: ruff format * Arm the prompt-length allowlist only on torch 2.8+ torch 2.7 caches its first read of compiler.config.dynamic_sources for the life of the process, so scoping the list to one forward is either ignored or leaks it into every later compile. 2.8 re-reads it when it changes and adds regex matching (is_dynamic_source), which the FBCache hook paths also need. Older torch keeps today's behaviour. * Trim comments * Trim comments on the prompt-length allowlist * Trim dynamic text dims comments * Drop dead torch<2.1 hook fallback and redundant in-test skips * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten dynamic text dims docstrings --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Studio: size the image memory plan at the dtype the pipeline loads in (SDXL resident on 24 GB) (#11922) * Studio: size the diffusion memory plan at the dtype the pipeline loads in The pipeline memory plan summed the cached shard bytes, which is what a repo stores rather than what the load holds. SDXL and SDXL-Turbo publish fp32 weights (12.9 GB) that load as 6.5 GB in bf16/fp16, so 20-24 GB cards planned whole-model offload for a model that fits resident, and a 16 GB unified-memory Mac refused it outright. Lumina-2 and Z-Image-Turbo ship fp32 shards the same way, and a cache holding fp16 variant twins, .bin twins or a single-file checkpoint beside the pipeline counted weights the loader never opens. Price each cached weight file the way from_pretrained materialises it: default-variant component files only, safetensors over a .bin twin, and a file whose floats are all wider than the load dtype at that dtype. Mixed precision, quantised and fp8 files, components whose class pins modules in fp32, and fp32 loads keep their stored size, and the estimate only ever lowers. Download sizes and disk checks are unchanged. * Studio: let the mirrored companion stub take the load itemsize * Studio: shorten the load-dtype sizing comments * Studio: widen half-precision weights on an fp32 load, keep a .bin the loader falls back to An fp32 target (a Mac without bf16, an fp16-incompatible family on an fp16 card) materialises bf16/fp16 shards at four bytes per element, so price every float at the load width there. A .bin is dropped only when its folder holds a safetensors checkpoint the loader can select: an unsharded file, or shards with their index. * Studio: honour Transformers' non-strict fp32 pins only on fp16 loads Transformers upcasts _keep_in_fp32_modules only when the load dtype is fp16 and _keep_in_fp32_modules_strict for both halves; Diffusers upcasts its set for both. A bf16 load of an fp32 T5 checkpoint is therefore priced at bf16. * Studio: price fp32-pinned modules at four bytes in half-precision loads A component whose class keeps modules in fp32 (T5's wo at fp16, a strict or Diffusers pin at either half) holds those tensors at four bytes whatever the checkpoint stores, so price them per tensor instead of leaving the file at its stored size. * Studio: match fp32 pins against the parameter path the way each loader does * Studio: price a surviving .bin checkpoint at the load dtype too * Studio: count a tied .bin weight once when pricing it * Studio: trim comments in the load-dtype memory plan * Studio: stop MiniMax-H3 recompiling on the second caption and the first i2v (#11880) * Studio: compile the prompt-length dims of Qwen-Image DiT blocks dynamic from the first render The max tier (and torchao weights on the default tier) compiles DiT blocks with automatic dynamic, so the first prompt's token count was compiled static and the first prompt of a different length recompiled every block graph into the generalised form it then kept (Qwen-Image-2.1: 14 s int8 default, 31 s bf16 max, 51 s int8 max; Qwen-Image: 52-57 s max). Name the block inputs whose size follows the prompt in torch.compiler.config.dynamic_sources, set only around the owning transformer's forward and restored even when it raises, so the first compile already builds the generalised graphs. The first segment start of Qwen-Image-2.1 stays static, which keeps clear of the torchao CantSplit that dynamic=True hits. The compile-cache key gains the allowlist only for these families. torch without the knob (2.6) is unchanged. * Studio: also mark Qwen-Image's text inputs dynamic when FBCache calls the blocks through hooks FBCache is on by default for Qwen-Image, and its hooks pass the block inputs as kwargs (or a resumed frame's stack after a graph break), so the plain L[...] names never matched and the second prompt length still recompiled. Suffix patterns cover those paths on torch 2.8+. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: ruff format * Arm the prompt-length allowlist only on torch 2.8+ torch 2.7 caches its first read of compiler.config.dynamic_sources for the life of the process, so scoping the list to one forward is either ignored or leaks it into every later compile. 2.8 re-reads it when it changes and adds regex matching (is_dynamic_source), which the FBCache hook paths also need. Older torch keeps today's behaviour. * Trim comments * Studio: compile MiniMax-H3's packed length dynamic from the first render A new caption changes H3's packed video + audio + caption length, and the first new caption after load recompiled the denoiser blocks (about 11 to 22 s). Name those inputs in the prompt-length allowlist so the first compile is already general, and keep the small-M int8 padding free of a branch on the row count when traced, which otherwise guarded the caption length to <= 31 rows and recompiled the refiner on the first i2v (a 540-row caption). * Pad traced rows with arithmetic max so a concrete row count still compiles torch.sym_max on a concrete int is rejected by dynamo on torch 2.8 and older, so a static compile of a padded int8 Linear broke (fullgraph drops the DiT to eager). builtin max() compiles but left an m <= pad_to guard behind on an inductor cache hit. (m + p + |m - p|) // 2 does neither. * Trim comments on the prompt-length allowlist * Trim comments on the H3 allowlist and traced row padding * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim dynamic text dims comments * Drop dead torch<2.1 hook fallback and redundant in-test skips * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten dynamic text dims docstrings --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Unsloth Studio / Desktop: log what an image load and each generation actually resolved to (#11994) * Studio: log what an image load and each generation actually resolved to * Studio: trim comments on the resolved and generation log lines * Studio: build the diffusion.loaded resolved field from the committed load state * Studio: log the applied denoise strength and native sd.cpp LoRAs in diffusion.generated * Studio: log the effective upscale factor, and only for the upscale workflow * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Unsloth Studio: stop offering "Continue" on a base repo that only holds a GGUF's text encoder and VAE (#11644) * Unsloth Studio: stop offering "Continue" on a base repo that only holds a GGUF's text encoder and VAE A companion-only snapshot stays partial so no picker loads it, but a new companion_prefetch flag keeps the Hub from presenting it as an unfinished download whose Continue pulls the denoiser the GGUF replaces. * Carry companion_prefetch through the local listing the Hub merges The Hub merges /api/hub/cached-models with /api/hub/local, and the local scanner knew nothing about companion-only snapshots. After a real GGUF load, its row for the base repo stayed Partial, and the detail pane still offered Continue at 33 GB. When the base repo held VAE and encoder shards, the same scanner classified it as a complete safetensors model instead, and the Hub offered Run on a pipeline with no denoiser. The local scanner now reads the same signal on the snapshot it lists: such rows are partial, as the cached listing marks them, and carry companion_prefetch. The frontend honours the flag on local rows too. * Keep a companion-only base repo out of model Discover's on-device and partial states buildDiscoverRows read partial and on-device straight off the cached or local row, so the new flag never reached the model Discover grid: the repo still read as a partial download there. * Show a companion-only base repo as a plain Download, not On device with Run Excluding the flag from the partial hf_cache branch sent the local row into the fully local view, which claims the repo is on device and offers Run on a pipeline with no denoiser. Keep the branch and clear only the partial state. * Key the Discover memo on the companion flag A companion fetch finishing leaves partial true on both listings and flips only companion_prefetch, so the signature the model Discover memo is keyed on did not change and the grid kept the repo as on device and partial. * Trim companion_prefetch comments * Keep Delete on a companion-only repo's download card The card gated its repo menu (Delete, path) on isDownloaded || isPartial, and a companion-only repo is now neither, so 19 GB of borrowed text encoder and VAE could no longer be deleted from the detail pane. * Drop the green On device dot from a companion-only inventory row * Trim comments --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Daniel Han <[email protected]> * Apply SFTConfig.router_aux_loss_coef to MoE models that cache it at init (#12006) * Apply SFTConfig.router_aux_loss_coef to MoE models that cache it at init * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten router_aux_loss_coef sync comments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Load only the language model for text_only on repo-code composites (#11861) * Load only the language model for text_only on repo-code composites FastModel.from_pretrained(text_only = True) skipped the vision tower only for families with their own text decoder (gemma3 -> gemma3_text). A repo-code composite such as Nemotron-3-Nano-Omni (llm_config + vision_config + sound_config, one wrapper class in auto_map) failed that test, so the whole wrapper was loaded and its forward required pixel_values. When trust_remote_code is set, the parent config is repo code, and every parameter of the text sub-config's causal LM (built on the meta device) is stored under exactly one checkpoint prefix, load that causal LM alone with a key_mapping stripping the prefix. Anything else keeps the previous full-model load, so no text weight can be left randomly initialised. * Also find the decoder of a repo-code composite under llm_config InternVL and Llama-Nemotron-Nano-VL keep the decoder config as llm_config without the text_config alias get_text_config() reads, so the text-only plan never saw it. Fall back to llm_config / language_config; the full-coverage checkpoint check still decides whether the branch is taken. * Keep the full-model load for repo-code composites on transformers 4.x transformers 4.x decides base-model vs task-model prefix handling from the checkpoint keys before key_mapping renames them, so a language_model. prefixed checkpoint either raises "state dictionary ... corrupted" or, with tied embeddings, loads every text weight as missing. Decline the text-only plan below 5.0 and skip the positive tests there. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Record the commit a trusted load ran repo code at A merged export that re-reads the repo's config with its code pins it to this commit instead of the branch head. Under text_only the model's config is the nested text config, which carries no commit, so the composite config's commit is taken before the remap. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pin the text-only config of a repo-code composite to the parent commit * Read a cached unsharded checkpoint when the text-only plan runs offline * Keep the full composite for adapters trained on it under text_only * Decline the text-only plan for repo-code composites under fast_inference * Accept sequence-valued auto_map entries in the text-only self-reference check * Rebase llm_int8_skip_modules once from the parent names for nested text prefixes * Pass torch_device to PeftModel.from_pretrained in the text-only adapter test * Probe sharded .bin composites for the text-only plan from their index * Pass local_files_only to the nested text class lookup of the text-only plan * Read adapter_model.bin names when deciding whether an adapter fits the text model * Probe the text-only plan at the commit its config was resolved at * Decline the text-only plan when the nested text class lives in another repository * Probe the text-only plan checkpoint under the requested subfolder * Keep the full composite for a device_map keyed on its module names * Probe the text-only plan checkpoint at the requested variant and cache_dir * Resolve the nested text class at the requested code_revision * Keep the full composite for an adapter on wrapper-only modules * Rebase the caller's quantization_config skip modules for the text-only plan * Stamp the code_revision commit as the trusted remote code commit * Stamp the rebased quantization_config on the text-only decoder * Save the text-only decoder under its standalone weight names * Pin the wrapper-only adapter test's PEFT load to the CPU * Give the text-only test namespace the remote class resolver resolve_model_class now calls * Trim comments in text-only remote composite loading * Add the license header to the text-only remote composite tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Try the text-only plan when a repo-code wrapper is its own text config (InternVL) * Rebase every quantization module-name list on the text model, and keep the full model for a regex that names the prefix * Detect a quantization regex that escapes any dot of a nested text prefix * Tighten comments in the text-only remote composite path --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Put back the unsloth_zoo modules the device map opt-in tests stub (#12038) * Studio: pass tool_result is_error through to the model on /v1/messages (#11962) Keep the Anthropic tool_result is_error flag on /v1/messages and mark failed tool output with an Error: prefix (or a short note when the output is empty) so the local model can tell a failed tool call from an empty success. * SentenceTransformer: add opt-in…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The transformers compat matrix in
tests/version_compat/test_transformers_pinned_symbols.pywas a hand-written tag list, so it answered for the day it was last edited. This reads the
releases from PyPI instead, keeps one tag per minor to stay bounded, and merges back the
anchors no automatic rule can derive.
Split out of #11016, which keeps the cap lift itself and a static list covering the window
that cap opens. Stacked on #11016: it branches from that PR's head rather than from
main, because the ceiling anchor and the ceiling CI lane both read the cap #11016 moves,so this cannot be verified against a tree where the cap is still 5.5.0.
What it does
_release_tags()readspypi.org/pypi/transformers/json, skips yanked and non-finalreleases, keeps the newest patch of each minor at or above the floor, and falls back to a
frozen list when PyPI cannot be read.
_with_always()is the single place every return path passes through. It merges:tokenizers>=0.23.1;pyproject.tomldeclares, read from the cap rather than repeated, androuted through
_TAG_OVERRIDESbecause upstream does not always tag a release underits own name.
PYTEST_TRANSFORMERS_MATRIX_FILEshares one resolved matrix across xdist workers, sofour independent PyPI reads cannot give four workers four different parameter sets. The
name is deliberately not in the
UNSLOTH_namespace: it is read by that one test module,nothing under
unsloth/orstudio/consults it, and it is inert at runtime.ceilinglane pinned to the declared maximum, so somethingimports the top of the window and not just the bottom.
lateststays as the forwardcanary and is the only lane marked
continue-on-error, since resolving outside thedeclared window is its job. The three lanes sit on three interpreters, which is what
keeps their pip cache keys distinct.
Six failure modes, each with a named test, each mutation proven
Every one of these was found in review of the original combined PR, and every one is a
regression somebody could reintroduce. Breaking each in turn and recording which test
catches it:
test_a_pypi_outage_keeps_every_load_bearing_tag,test_an_empty_release_index_keeps_every_load_bearing_tagtest_the_declared_ceiling_stays_in_the_matrix_after_a_patch_releasetest_the_matrix_is_shared_between_xdist_workerstest_a_pinned_patch_release_is_not_evicted_by_a_later_onetest_no_two_import_lanes_mint_the_same_pip_cache_keytest_a_published_matrix_still_carries_the_anchorstest_the_declared_ceiling_anchor_uses_the_tag_upstream_pushedVerification
Cold, with
PYTEST_TRANSFORMERS_MATRIX_FILEcleared,-n 4 --dist loadfileovertest_transformers_cap_sites.py,test_transformers_pinned_symbols.pyandtest_pip_cache_naming.py: 571 passed, 1 skipped.Exercising the CI sharing path end to end, the pre-resolve step writing the file and pytest
reading it: 23 tags resolved, 436 passed, 1 skipped.