Repository navigation
fix(deps): allow transformers 5.18 - #17903
Conversation
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 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". |
…nslothai#2554) Lets unsloth-zoo resolve transformers 5.18.0, so vision SFT with TRL's `assistant_only_loss=True` works (unslothai/unsloth#17847; transformers 5.18 fixed processor assistant masks for expanded image placeholders, huggingface/transformers#48793, and TRL 1.15 already gates vision `assistant_only_loss` on it). The unsloth side is unslothai/unsloth#17903. ## Changes - **Gemma3 assistant masks on 5.18.** Zoo replaces `Gemma3Processor.__call__` and never returned `text_replacement_offsets`, which 5.18 uses to shift assistant spans past the expanded image tokens, so with Unsloth the mask landed on `<image_soft_token>` (4 of 299 tokens kept, all image tokens) while plain transformers + TRL was correct. The offsets are now computed in the same expansion pass and returned only when requested. - **Caps:** both `transformers` caps in `pyproject.toml` to `<=5.18.0`, plus `CEILING` in `consolidated-tests-ci.yml` and `TESTED_CEILING` in `tests/test_published_version_window.py`. ## Results FastVisionModel + TRL 1.15 SFTTrainer, `assistant_only_loss=True`, 2-turn image chat (correctness on B200, losses match plain HF: Gemma3 12.43 vs 12.428): | model | transformers 5.18, kept assistant text | |---|---| | Gemma3, zoo main | 4 / 299 tokens, all `<image_soft_token>` | | Gemma3, this PR | `A red square.<end_of_turn>\nIt is red.<end_of_turn>\n` (12 / 299) | | Qwen2.5-VL / Qwen3-VL | `A red square.<\|im_end\|>\nIt is red.<\|im_end\|>\n` (unchanged) | 5.17 vs 5.18 on the zoo suite: the same failing test IDs on both (all from dynamo being off on CPU), none new on 5.18. ## Tests `tests/test_gemma3_processor_assistant_mask.py`: 6 fail on main, 8 pass here (skips below 5.18; the existing Gemma3 processor tests still pass on 5.17 and 4.57.6).
transformers 5.18 (huggingface/transformers#47611) resolves the Hub revision once per load and no longer stamps config._commit_hash. Unsloth reads it to pin remote code, text-only probes, exports and drafts to the commit the config was read at, so every one of those silently fell back to the moving branch. Record the resolved commit again (only where transformers dropped it).
…s 5.18 transformers 5.18 (huggingface/transformers#48974) renames the V3.2 DSA layer type from deepseek_sparse_attention to indexed_attention. The Ulysses forward builds its own mask for these layers either way, so keep both names exempt.
…ally unsloth-zoo unslothai#2551 wraps flex_attention_mask over Unsloth's graph-break fix and calls it with the mask arguments bound positionally. The fix only looked at keyword arguments, so under torch.compile it fell through to transformers' fast_all branch: a data-dependent graph break (fullgraph fails on 5.17 and 5.18 alike). Bind the arguments by name from the signature instead.
transformers 5.18 (huggingface/transformers#48974) adds from __future__ import annotations to configuration_utils, so the base config fields carry string annotations that @strict skips: LlamaConfig accepts any problem_type. Check Unsloth passes such a value through untouched there and still expect a validation error where transformers validates the field.
…ers 5.18) transformers 5.18 (huggingface/transformers#49177) splits each deepstack layer returned by Qwen3-VL get_image_features per image, like pooler_output. The float32 wrapper already casts every tensor inside; the test concatenates the split before comparing with the tower's own output. [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
|
pre-commit.ci run |
# Conflicts: # unsloth/import_fixes.py
…17999) ## Summary `pip scan-packages :: hf-stack` fails on main since unsloth-zoo 2026.11.5 reached PyPI (for example run 43918369724 on a push to main, and on #17903): ``` 9 of the 184 finding(s) above are at a site already reviewed in scripts/scan_packages_baseline.json. What differs from the reviewed entry: HIGH unsloth_zoo/compiler.py same matched code, file digest outside the pin CRITICAL unsloth_zoo/llama_cpp.py (env + network) 1 matched line(s) added and 1 gone: the flagged code was rewritten CRITICAL unsloth_zoo/llama_cpp.py (archive + network) 1 matched line(s) added and 1 gone: the flagged code was rewritten HIGH unsloth_zoo/mlx/loader.py same matched code, file digest outside the pin HIGH unsloth_zoo/mlx/speculative.py 3 matched line(s) added and 2 gone: the flagged code was rewritten HIGH unsloth_zoo/temporary_patches/granitemoehybrid.py same matched code, file digest outside the pin HIGH unsloth_zoo/temporary_patches/moe_utils.py same matched code, file digest outside the pin CRITICAL unsloth_zoo/vision_utils.py (env + network) same matched code, file digest outside the pin CRITICAL unsloth_zoo/vision_utils.py (IMDS + network) same matched code, file digest outside the pin ``` This is the per-release re-review the digest pins exist for, as in #17421 (2026.11.4). ## Review I diffed the seven files between the 2026.11.4 and 2026.11.5 wheels downloaded from PyPI. - Six of the nine new entries have the same `evidence_hash` as an already reviewed entry: the matched code is unchanged and only the file digest moved. - None of the added lines in the seven files add `exec`, `eval`, `compile` on code, `marshal`, `zlib`, `__import__`, HTTP or socket calls, subprocesses, archives or the metadata address. The only new environment reads are Unsloth's own `UNSLOTH_*` switches. | File | What changed in 2026.11.5 | Verdict | |---|---|---| | `unsloth_zoo/llama_cpp.py` | `_check_llama_cpp_appended_system_message` moves its existing `requests.get(llama_cpp_chat_file, timeout = 5)` inside the `try` and narrows the bare `except`; `add_llama_cpp_system_message` keeps the message's other fields when it appends. Same URL constant, no new network call | benign | | `unsloth_zoo/mlx/speculative.py` | DFlash2 draft tree sizing and round overhead. The rewritten matched lines are `mx.eval` / `mx.async_eval` (MLX array evaluation, not Python `eval`); the one `__import__` (`mlx_vlm.models.{family}.language`) is unchanged | benign | | `unsloth_zoo/compiler.py` | SDPA `is_causal` symbolic-bool rewrite (a new `re.compile` pattern), modeling-file unpatch keyed by the resolved location | benign | | `unsloth_zoo/vision_utils.py` | video reads fall back to PyAV when torchvision or `io.read_video` is missing, plus a tensor resize helper | benign | | `unsloth_zoo/temporary_patches/moe_utils.py` | grouped GEMM / expert cache policy, read from `UNSLOTH_MOE_*` switches | benign | | `unsloth_zoo/temporary_patches/granitemoehybrid.py` | float16 patch keeps the layer's gradient checkpointing | benign | | `unsloth_zoo/mlx/loader.py` | MLX auto offload sizes the prefill step to the working set and caps a requested `prefill_step_size`; the one `__import__(module_name, fromlist=["_"])` is unchanged | benign | ## Change Nine entries added to `scripts/scan_packages_baseline.json`, each next to the reviewed entries of its site, written by `scan_packages.py --write-baseline` over `unsloth-zoo==2026.11.5` with the current baseline as the pin source. Pinned sites stay pinned to the new file digests; the llama.cpp archive site was unpinned before and stays unpinned. No other entry moves. ## Verification - `scan_packages.py unsloth-zoo==2026.11.5`: exits 1 with main's baseline (the nine sites above), exits 0 with this one (24 findings suppressed, 15 MEDIUM left). - `tests/security/test_scan_packages.py` and `tests/studio/install/test_diffusers_pin.py`: 218 passed.
Fixes #17847
What changed
This preserves all existing rejected-release exclusions and the Apple Silicon sidecar policy.
Validation
pytest -q tests/test_transformers_cap_sites.py(26 passed, 1 skipped)pytest -q tests/version_compat/test_transformers_pinned_symbols.py(1043 passed, 11 skipped)git diff --checkNote: the currently published
unsloth_zoo==2026.11.4metadata still advertisestransformers<=5.17.0; users will resolve 5.18.0 once the matching unsloth-zoo dependency release is published.