Skip to content

Studio: default transformers 5.5.4, highest sidecar 5.13.1, and SageAttention on current torch - #17589

Merged
danielhanchen merged 9 commits into
mainfrom
studio-transformers-5-5-4
Nov 13, 2026
Merged

danielhanchen merged 9 commits into
mainfrom
studio-transformers-5-5-4

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Three changes to Studio's transformers tiers and diffusion attention:

  1. Default transformers 5.5.0 -> 5.5.4. The main env pin moves in extras-no-deps.txt, no-torch-runtime.txt, single-env/constraints.txt and single-env/overrides-darwin-arm64.txt, and TRANSFORMERS_DEFAULT_VERSION follows. The Gemma 4 sidecar (.venv_t5_550) moves to 5.5.4 with it, so a Gemma 4 / DiffusionGemma / LLaDA load never steps back below the main env.
  2. Highest sidecar 5.10.2 -> 5.13.1. .venv_t5_510 is the highest pre-installed tier and now holds 5.13.1 (setup.sh, setup.ps1, TRANSFORMERS_510_VERSION). The directory name and the "510" tier key stay as they are, so existing installs rebuild that sidecar in place on the next update and nothing that stores a tier key changes. Custom-code models saved by 5.11 to 5.13 now route to this tier instead of needing the opt-in latest sidecar. 5.13.1 checks safetensors>=0.8.0 at import and the sidecar installs --no-deps over the main env, so studio.txt now asks for safetensors>=0.8.0 on every platform (it was Windows only).
  3. SageAttention works again in the diffusion path. See below.

The opt-in .venv_t5_latest sidecar is unchanged: it still installs whatever PyPI's latest release is when the user consents. There is no other transformers ceiling in Studio; the <=5.17.0 cap in pyproject.toml is Unsloth Core's and is untouched.

Why sage never engaged

transformers before 5.13 can only be imported next to kernels < 0.15, so the installer ships kernels==0.12.3 and #17576 keeps it there. kernels 0.12.3 downloads from the model-type copy of kernels-community/sage-attention. That copy's newest builds are for torch 2.12. The current builds (torch 2.10 to 2.15) live in the kernel-type repo, which newer kernels releases read (0.18.2 does, 0.12.3 does not). On the cu130 / Python 3.13 route the installer takes on Colab, which installs torch 2.13, every sage request therefore falls back to native:

version 2: FileNotFoundError: Cannot install kernel from repo kernels-community/sage-attention
version 1: FileNotFoundError: Cannot install kernel from repo kernels-community/sage-attention
version 3: ValueError: Version 3 not found, available versions: 1, 2

No kernels release both reads the kernel-type repo and keeps transformers 5.5 importable, so this PR does not change the kernels pin. Instead core/inference/diffusion_sage_hub.py loads the build without the kernels package:

  • It works out the build variant names this torch can load (both torch213-cxx11-cu130-x86_64-linux and the newer torch213-cu130-x86_64-linux, plus older CUDA minors of the same major).
  • It lists the kernel-type repo (version 2 first, since it also covers sm100, then version 3) and falls back to the model-type copy.
  • It downloads metadata.json first and checks the build's CUDA archs against the card, so a T4 or an RTX PRO 6000 never downloads the build.
  • It downloads that one variant, checks every file against the sha256 digests in metadata.json, refuses builds that declare Python dependencies, and imports it under a private module name.

_load_sage_hub_kernel tries this first and keeps kernels.get_kernel as the fallback. transformers' own kernels import is never touched, and the existing accuracy probe, dispatch guard and opaque custom op are unchanged.

kernels_compat now pins the on-demand kernels install on the oldest transformers that will import it, which is the main env or any sidecar (they install --no-deps over the same env). With this PR the 5.3.0 and 5.5.4 sidecars and the 5.5.4 main env all keep it at kernels==0.12.3. A future main env on 5.13+ would still get 0.12.3 while an older sidecar exists.

GPU evidence (Colab L4 and A100 40GB)

Each VM did a fresh install.sh --local of this branch (exit 0, 180 s on both), which picked Python 3.13, torch 2.13.0+cu130, transformers 5.5.4, tokenizers 0.22.2, kernels 0.12.3, diffusers 0.42.1, huggingface_hub 1.33.0 and safetensors 0.8.0.

transformers import in the main env and in each sidecar (import transformers.activations and transformers.integrations.hub_kernels, with the installed kernels 0.12.3), on both VMs:

Env transformers Imports gemma4_unified in CONFIG_MAPPING
main env (unsloth_studio) 5.5.4 OK, plus from diffusers import DiffusionPipeline OK no
.venv_t5_530 5.3.0 OK no
.venv_t5_550 5.5.4 OK no (gemma4 yes)
.venv_t5_510 5.13.1 OK yes

Sage, base vs head. Same VM and same installed env for both arms. Only the Studio backend tree differs: base is the merge base c6712db78f and head is this branch. The render is FLUX.2 [klein] 4B (bf16, 768x768, 4 steps, seed 1234) through apply_attention_backend(pipe, "sage", target=pipe.transformer). The call counter wraps the sage_hub kernel function after the backend is applied:

L4 base L4 head A100 base A100 head
hub build loads no (FileNotFoundError) yes, 10.4 s cold no (FileNotFoundError) yes, 6.5 s cold
probe, head_dim 64 (cos / rel L1) not reached 0.99939 / 0.0351 PASS not reached 0.99994 / 0.0105 PASS
probe, head_dim 128 (cos / rel L1) not reached 0.99939 / 0.0347 PASS not reached 0.99994 / 0.0109 PASS
backend engaged native sage_hub native sage_hub
sage kernel calls in the render 0 100 (25 attention blocks x 4 steps) 0 100
masked calls rerouted to native 0 0 0 0
LPIPS vs the native render 0.0 (it is the native render) 0.0178 (PSNR 29.7 dB) 0.0 0.0040 (PSNR 37.8 dB)
peak VRAM 16.28 GiB 16.28 GiB 16.28 GiB 16.28 GiB

The probe gate is cosine >= 0.99 and relative L1 <= 0.08 against fp32 SDPA. Two native renders with the same seed are bit-identical (LPIPS 0.0), so the sage deltas are the kernel's quantization and not run-to-run noise. Both are well inside the 0.10 LPIPS bar Studio uses for lossy diffusion paths. These are single-render smoke timings on shared VMs, so no speed claim is made.

Default-tier training on the same L4 install: Unsloth LoRA SFT, Qwen2.5-0.5B-Instruct 4-bit, 20 steps, transformers 5.5.4 loaded from the main env. Loss went from 2.778 to 0.280, and greedy decoding of a held-out prompt gives the right answer.

The 5.5.0 -> 5.5.4 change itself was checked separately on the Core jobs matrix (T4 and L4, everything else pinned identically): sft, dpo, orpo, moe_sft and inference_smoke are bit-identical, vision_sft is within tolerance, and vLLM 0.28 runs on 5.5.4, which it does not on 5.5.0 (vLLM 0.19.1 to 0.23 exclude 5.5.0 and 0.24+ require >= 5.5.3).

Tests

  • New tests/test_diffusion_sage_hub.py (CPU, no network): variant names, CUDA arch compatibility for A100 / L4 / H100 / B200 / RTX PRO 6000 / T4, digest tampering, refused Python dependencies, kernel-repo then model-copy order, metadata-only fetch on an unsupported card, the offline cache path, a real import with relative submodules, and the order inside _load_sage_hub_kernel (the direct build wins, get_kernel is the fallback, and nothing downloads while kernels is not importable).
  • tests/test_kernels_compat.py: sidecar scan (skips .staging / .old), oldest-version keying, pre-release ordering.
  • tests/studio/install/test_transformers_tokenizers_pair.py: windows for 5.5.4 and 5.13.1, and a new check that every sidecar release declares the same tokenizers window the main env installs.
  • Tier routing tests updated to read the version constants; added a case where 5.12 and 5.13 custom code now fits the 5.13.1 sidecar without the latest-tier offer.
  • The Studio backend tier, kernels, diffusion attention, sage gate, export, LTX-2.5, MOSS and native audio suites pass. One failure, test_an_imported_old_kernels_is_not_papered_over, fails the same way on main.

Not covered

  • T4 (sm75) and RTX PRO 6000 / G4 (sm120): neither hub build lists these archs, so sage declines with the reason logged and nothing beyond metadata.json is downloaded. This is covered by unit tests and by the archs read from the live hub metadata, but was not run on those GPUs.
  • H100 and B200 were not run.
  • Windows and macOS: the direct loader is Linux only, and other platforms keep the kernels.get_kernel path they had. setup.ps1 sidecar bumps were not run on Windows.
  • Updating an existing install, where the 550 and 510 sidecars rebuild and safetensors moves up, was not exercised. Only fresh installs were.
  • No Gemma 4 Unified or other 510-tier model was loaded or trained on 5.13.1. That sidecar was checked only by import and its config mapping. Custom-code models that ran on 5.10.2 now run on 5.13.1 and were not tested.
  • The render was driven through apply_attention_backend with a diffusers pipeline, not through the Studio UI.
  • The kernel-type kernels-community/sage-attention repo currently redirects to SageAttention/sage-attention. The loader follows that redirect and verifies digests, but does not check the sigstore signature.

The main env pin moves from 5.5.0 to 5.5.4 (extras-no-deps, no-torch-runtime,
single-env constraints and the darwin override), and the Gemma 4 sidecar
(.venv_t5_550) moves with it. The highest pre-installed sidecar (.venv_t5_510)
moves from 5.10.2 to 5.13.1; its directory and tier key stay, so existing
installs rebuild it in place. 5.13.1 checks safetensors>=0.8.0 at import and
the sidecar installs --no-deps, so studio.txt now asks for safetensors>=0.8.0
on every platform (it was Windows only). The config-parse log reads the
sidecar versions from the tier table instead of hardcoding them.
… kernels package

kernels 0.12.3, the release transformers < 5.13 can import next to, reads the
hub's model-type copy of kernels-community/sage-attention, whose builds stop at
torch 2.12, so on torch 2.13 sage never engaged. The new loader fetches the one
build variant this torch needs from the kernel-type repo (the model-type copy
is the fallback), reads metadata.json first so an unsupported card downloads
nothing else, checks the build's CUDA archs and sha256 digests, and imports it
under a private module name. kernels.get_kernel stays as the fallback, and
transformers' own kernels import is untouched.

kernels_compat now pins the on-demand kernels install on the oldest
transformers that will import it: the main env or any sidecar, since the
sidecars install --no-deps over the same env.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T12:40:13.444489Z 11ab855 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 2644883e0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26724971ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

safetensors>=0.8.0; sys_platform == "win32" and python_version >= "3.10"
# Windows video loads read fp32 shards with the pread backend (core/inference/safetensors_pread.py, #9977), and the
# transformers 5.13.1 sidecar (.venv_t5_510, installed --no-deps over this env) checks safetensors>=0.8.0 at import.
safetensors>=0.8.0; python_version >= "3.10"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mirror the safetensors floor in the published Studio extra

On Linux and macOS, pip install "unsloth[studio]" still uses the Windows-only safetensors requirement in pyproject.toml, so an existing safetensors 0.7 installation can remain installed. The newly bumped 5.13.1 sidecar then fails its safetensors version check: _VENV_T5_510_PACKAGES installs transformers without dependencies and does not upgrade safetensors. Apply the same platform-marker change to the published studio extra so pip-installed environments receive the dependency required by this sidecar. The existing test_studio_extra_matches_requirement_versions also fails on this mismatch.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2e7d21f: the published studio extra now applies safetensors>=0.8.0 on every platform (python >= 3.10), matching requirements/studio.txt; test_studio_extra_matches_requirement_versions passes again.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 2e7d21fe03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

…_torch

AMD SDK / Radeon wheels leave torch.version.hip unset and carry the ROCm tag
only in torch.__version__; route the hub loader's CUDA-build check through the
shared is_rocm_torch helper like every other diffusion gate, so such a wheel
never resolves a CUDA build variant. Adds tests for the tag-only and stock ROCm
wheels and a CUDA control.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 11ab85584b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit fc6ae90 into main Nov 13, 2026
@danielhanchen
danielhanchen deleted the studio-transformers-5-5-4 branch November 13, 2026 13:08
danielhanchen added a commit that referenced this pull request Nov 13, 2026
# Conflicts:
#	studio/backend/core/inference/diffusion_sage_hub.py
#	studio/backend/tests/test_diffusion_sage_hub.py

[skip ci]
danielhanchen added a commit that referenced this pull request Nov 13, 2026
…per-call device sync on sm89 (#17639)

## Summary

Stacked on #17589 (base branch `studio-transformers-5-5-4`, which loads
the SageAttention hub build). Retarget to `main` once that merges.

MiniMax-H3 / H3-Image attention with SageAttention got slower, not
faster, because of two problems. This PR fixes both. On an L4 the DiT's
attention time per 2048x2048 image drops from 2.8 s (native flash) to
2.0 s with Sage, quantisers included. The output is bit-identical to the
existing Sage route.

1. **Sage ran in the stock processor.** Any Sage backend (`sage` /
`sage_hub`) sent each H3 attention call back to the stock processor.
That lost Studio's strided layout, the fused q/k RMSNorm + RoPE and the
shared QKV act quant. The strided processor now does all of that itself.
It then passes the NHD q / k / v it already holds to the same guarded
dispatch the stock processor uses, so calls Sage cannot take still run
native. H3 video also installs the strided processor when Sage is the
engaged backend. Kill switch: `UNSLOTH_H3_STRIDED_SAGE=0`.
2. **The hub build synchronizes after every call on sm89.** Its sm89
route calls `torch.cuda.synchronize()` after every attention launch. On
the streamed tier that drained the weight prefetch 300 times per image
and left the GPU idle for 2.2 s of a 14.3 s denoise. The loader now
wraps the build's `sageattn`. On sm89 it runs the build's own quantisers
and attention op with the same arguments, in the same order, without the
sync.
- The build's CUDA ops launch on the default stream whatever stream is
current; that is what the sync was hiding. The wrapper therefore runs
the whole call on the default stream and orders it against a caller on
another stream with stream waits.
- Other cards, causal or LSE calls, grouped heads and head dims other
than 64 / 128 call the build as shipped. Kill switch:
`UNSLOTH_SAGE_SM89_NO_SYNC=0`.

## Results

Colab L4, streamed int8 tier, torch 2.13.0+cu130, 6 steps, seed-matched.
Base is the same tree without these commits, with the per-card attention
race from #17615 applied to both arms (on L4 it picks native flash on
base and Sage with this PR). Each arm was rendered twice and the repeats
were byte-identical. Denoise times are in seconds.

| | base | base repeat | this PR | this PR repeat |
|---|---|---|---|---|
| 2048 t2i, s/img | 17.44 | 17.35 | 16.86 | 16.83 |
| 2048 t2i, denoise | 14.06 | 14.02 | 13.52 | 13.51 |
| 2720x1536 edit, first, s/img | 53.10 | 51.60 | 46.55 | 46.56 |
| 2720x1536 edit, repeat, s/img | 42.40 | 42.18 | 37.33 | 37.34 |
| 2720x1536 edit, repeat, denoise | 41.0 | 41.0 | 36.1 | 36.1 |
| 1024 t2i, s/img | 8.39 | 8.38 | 8.40 | 8.41 |

A second L4 VM gave the same deltas: 2048 went from 16.63 / 16.72 to
16.22 / 16.19 s/img, and the edit repeat from 41.45 / 41.71 to 36.63 /
36.68 s/img. At 1024 Sage is a tie: 0.01 to 0.03 s slower.

The table below separates the two fixes. All three arms force Sage
(`UNSLOTH_H3_IMAGE_INT8_ATTENTION=1`). The first two rows come from one
L4 VM (base 13.45 s denoise there) and the last from another (base 13.33
s).

| Sage route | 2048 denoise s | edit repeat denoise s | images |
|---|---|---|---|
| stock processor, sync (before) | 15.58 | 41.5 | reference |
| strided processor, sync | 14.32 | 36.8 | byte-identical |
| strided processor, no sync (this PR) | 12.94 | 35.5 | byte-identical |

L4 profile of one 2048 render (DiT window):

| | base (flash) | this PR (Sage) |
|---|---|---|
| attention kernel, per call | 9.21 ms | 5.30 ms |
| Sage quantisers, per call | n/a | 1.40 ms |
| DiT window | 14.13 s | 13.62 s |
| idle inside the window | 17 ms | 21 ms (2237 ms with the sync, on the
first VM) |

On the edit the attention kernel drops from 50.6 to 28.8 ms per call,
plus 3.6 ms of quantisers. The DiT window goes from 40.9 to 36.1 s.

On an A100 (sm80, resident), the race keeps native flash, as before: a
block took 6.85 ms with Sage against 6.69 ms native. With Sage forced,
2048 is a tie (3.50 s denoise both) and the edit is 4% faster (10.7 to
10.2 s).

## Accuracy

The two fixes do not change any value: every Sage render here is
byte-identical to the same render through the existing Sage route.
Whether a card uses the checkpoint's INT8 attention at all is a separate
policy: on this branch it is used as the checkpoint declares; #17615
adds a per-card race that keeps it only where it times faster, and with
this PR that race picks Sage on L4 (native on A100). For that decision,
Sage against native:

- **Against the native render on the same VM:** LPIPS 0.06 to 0.20 on
the 2048 prompts and 0.016 / 0.048 on the edit. The A/A floor is 0:
native repeats are byte-identical, and so are native flash against
native cuDNN.
- **Against a bf16 DiT render** (RTX PRO 6000, same seeds), mean over
the same 8 renders:

| render | LPIPS vs bf16 |
|---|---|
| int8 GEMM + native attention, L4 | 0.082 |
| int8 GEMM + Sage, L4 | 0.089 |
| int8 GEMM + native attention, A100 | 0.074 |
| int8 GEMM + Sage, A100 | 0.097 |

## Tests

- `tests/test_video_minimax_h3_attn.py` adds CPU tests:
- with a stand-in guarded backend, Sage runs inside the strided
processor (the stock processor is never called) and matches the stock
route bit for bit, fused and unfused;
- the kill switch, the backends that still go to the stock processor, a
masked call, the install routing table, and the H3 video gate.
- `tests/test_diffusion_sage_hub.py` adds CPU tests for the sm89
wrapper: the ops and arguments it runs, every fallback, the kill switch,
other cards, and builds without the sm89 parts.
- On the L4 VM, the no-sync route is bit-identical to the build's
`sageattn` at the 2048 and edit shapes, called from both the default
stream and a side stream.
danielhanchen added a commit that referenced this pull request Nov 14, 2026
… that checkout (#17757)

## Problem

The `mac macos-15 / trace / file` leg of Clean machine install has
failed on main since #17589 (first at `fc6ae908`, again at `2563c38e`),
and on every staging run that includes the workflow:

```
uv failed, falling back to pip...
error: No solution found when resolving dependencies
  cause: Because you require transformers==5.5.4 and transformers==5.5.0, we can conclude that your requirements are unsatisfiable.
...
##[error]installer invoked toolchain: rustc
```

That leg (and `mask / pipe`) is `overlay: false`, so it installs the
released wheel (2026.11.4, which pins `transformers==5.5.0`). But
`install.sh` exports `UV_OVERRIDE` from the checkout's
`studio/backend/requirements/single-env/overrides-darwin-arm64.txt`
whenever that file sits next to the script, and after #17589 the
checkout pins 5.5.4. The two disagree, so the MLX stack and the no-deps
extras step both fail in uv and fall back to pip. On the trace leg the
fallback probes `rustc --version`, which the notools assert rejects. The
`mask / pipe` leg hits the same conflict but has no rustc to probe, so
it passes while still testing a mix of two releases.

#17589 itself is correct; the installer was applying one tree's pins to
another tree's wheel. Any pin bump will trigger it again until the next
release ships.

## Fix

Take the checkout's override file only when the checkout is what gets
installed (`--local`, or the CI source overlay). Otherwise
`_bootstrap_packaged_mlx_override` (already there for piped installs)
reads the released wheel's own copy, so a non-overlay leg now gets
exactly what a user running `curl -fsSL https://unsloth.ai/install.sh |
sh` gets. `--local` and overlay installs are unchanged.

## Tests

- `tests/sh/test_install_uv_override_space.sh` extracts the selection
block and runs it as a checkout's `install.sh` (`$0` pointing into a
fake checkout). It covers released-wheel, `--local`, CI overlay, Intel
macOS and Linux. 30 passed.
- Sabotage: with the new condition removed, the released-wheel case
fails (`UV_OVERRIDE=<checkout>/.../overrides-darwin-arm64.txt`).
- `bash -n` and `dash -n` on `install.sh` are clean.
- The 55 pytest files that reference `install.sh` fail on the same 15
test IDs with and without this change. Those failures are host-only
(Windows ROCm bnb), and the change adds none.
danielhanchen added a commit that referenced this pull request Nov 22, 2026
…macOS XProtect block) (#18888)

## Move the highest transformers sidecar from 5.13.1 to 5.15.1

Related: #18699, #18883.

### Why

On macOS 26/27, XProtect checks the command line of processes started
from a pasted `curl ... | sh` install against Google Safe Browsing. It
reads a dotted version the way `inet_aton` does, so
`transformers==5.13.1` becomes `http://5.13.0.1/`. Google Safe Browsing
currently lists that URL as phishing (a fresh VirusTotal scan today
returns `Google Safe Browsing: phishing`; its stored 2016 record was
clean). The block id `url-3a20768066824ab0...` in the macOS log is the
SHA-256 of `http://5.13.0.1/`.

#18883 keeps the sidecar pins off argv. This PR also moves the pin
itself, so the version string no longer appears in any process, log line
or doc snippet that a user might paste.

### Why 5.15.1

| Version | tokenizers window | `import transformers` next to tokenizers
0.22.2 | `gemma4_unified`, `gemma4_assistant`,
`gemma4_unified_assistant` |
|---|---|---|---|
| 5.13.1 (current) | `>=0.22.0,<=0.23.0` | OK | yes |
| 5.14.1 | `>=0.22.0,<=0.23.0` | OK | yes |
| **5.15.1** | `>=0.22.0,<=0.23.0` | **OK** | **yes** |
| 5.16.1 | `>=0.23.1,<0.24.0` | fails: `tokenizers>=0.23.1,<0.24.0 is
required ... but found tokenizers==0.22.2` | n/a |

The sidecar is installed `--no-deps` and imports the main env's
tokenizers (pinned `<=0.23.0`), so 5.15.1 is the newest release that is
a drop-in. 5.16 and later would need their own tokenizers in the
sidecar.

The IP forms of all three sidecar pins after this change (`5.15.0.1`,
`5.5.0.4`, `5.3.0.0`) came back clean from a fresh Google Safe Browsing
scan via VirusTotal.

### Change

- `studio/setup.sh`, `studio/setup.ps1`: `.venv_t5_510` audit,
offline-defer loops, install call and step labels use 5.15.1.
- `studio/backend/utils/transformers_version.py`:
`TRANSFORMERS_510_VERSION = "5.15.1"`; the runtime repair reads its
package list from it.
- `studio/backend/requirements/studio.txt`: comment only (5.15.1 also
requires `safetensors>=0.8.0`).
- Tests: tokenizers-window table keyed on 5.15.1; kernels sidecar-scan
fixtures; the custom-code routing tests now pin the tier version where a
case depends on it being below the fake main release.

### Existing installs update automatically

- `unsloth studio update` or rerunning the install command:
`_sidecar_current` / `Test-SidecarCurrent` see 5.13.1 where 5.15.1 is
required, then wipe and rebuild `.venv_t5_510`.
- Without an update: the first load of a 510-tier model (Gemma 4 Unified
/ 12B, custom code saved by 5.11 to 5.15) runs
`_ensure_venv_t5_510_exists`, which compares the installed `Version:`
with `TRANSFORMERS_510_VERSION` and rebuilds on a mismatch.
- Offline (`UV_OFFLINE`): deferred to the next online update, as for
every sidecar.

### Verification

- `studio/backend/tests/test_transformers_latest.py`,
`studio/backend/tests/test_kernels_compat.py`,
`tests/studio/install/test_transformers_tokenizers_pair.py`: 169 passed,
1 skipped.
- Wider set (transformers_version, tiktoken, tokenizers/torch
constraint, fast-path guard, update idempotency, manifest pass evidence,
cap sites) on this change: 752 passed, 13 skipped. The one failure,
`test_main_offered_when_pypi_is_behind`, relied on the old pin being
below its fake 5.14 main release and is fixed here.
- `bash -n studio/setup.sh` clean; pre-commit ruff clean.

### Not covered

- No Gemma 4 Unified model was loaded or trained on 5.15.1; checked by
import and config mapping only, as #17589 did for 5.13.1.
- Not yet re-run as a copied-from-browser install on a Mac.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant