Skip to content

Studio: install the released Diffusers 0.41.0 instead of the pinned main commit - #13045

Merged
danielhanchen merged 11 commits into
mainfrom
studio-diffusers-0.41.0-release
Oct 8, 2026
Merged

danielhanchen merged 11 commits into
mainfrom
studio-diffusers-0.41.0-release

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #11906. Refs #11567.

Problem

Qwen-Image-2.1 needs QwenImage21Pipeline, which only existed on diffusers main, so Studio pinned a main commit (80c7ed26, diffusers-main.txt) and installed it from GitHub on top of the 0.40.0 release. Every host where that GitHub install did not land (no git and no zip route, github.com unreachable, an update that skipped the pass, a recorded earlier failure) stayed on 0.40.0 and refused the model:

'qwen-image-2.1' needs diffusers >= 0.41.0 (QwenImage21Pipeline), which has not been released yet; this environment has diffusers 0.40.0.

The reports in #11567 and #11906 are Desktop installs in exactly that state; the only way out was a hand install into the Studio venv.

diffusers 0.41.0 shipped on PyPI on 2026-10-06 with QwenImage21Pipeline and single-file support for QwenImage21Transformer2DModel. 80c7ed26 is an ancestor of v0.41.0.

Change

  • diffusers-pin.txt: diffusers==0.41.0 on Python >= 3.10 (3.9 stays on 0.36.0).
  • diffusers-main.txt: the requirement line is commented out, not deleted. The whole git-main route (step 11c, the zip fallback, the startup self-heal, the fast-path probe) stays, and comes back by uncommenting the line for a future unreleased model. The file header says how.
  • install_python_stack.py: _diffusers_main_active() says whether that file pins anything. Without it an all-comment file reads as "build missing", so the fast path would force a dependency pass on every update, 11c would install an empty file and record a failure, and the startup self-heal would retry on every first boot. With no active line:
    • 11c records skipped with the label diffusers main (none pinned, skipped) and runs nothing;
    • --diffusers-main-needs-dependency-pass answers "is the resident diffusers older than the release pin, or missing" (metadata only; a git / zip / checkout build is compared on release numbers, so the retired 80c7ed26 build (0.41.0.dev0) counts as current, while an index prerelease such as 0.41.0rc1 does not);
    • --repair-diffusers-main installs diffusers-pin.txt under the pass lock when the resident diffusers is an index install older than the pin (a user checkout / git / zip build is left alone, also after waiting out a peer), recording a failure under a new diffusers_release_repair key, so an old git-main failure cannot block the PyPI repair. A full update pass drops both keys;
    • --prefetch-diffusers-main fetches the release and its dependencies into uv's cache through a scratch --target, under the same constraints file as the install, when the resident diffusers is older, so the download happens where a timeout is recorded and startup continues, and the install that follows runs from cache. Otherwise it returns "nothing to do".
  • utils/diffusers_repair.py (startup self-heal, runs before the app imports diffusers): with no active line it acts only on an index install older than the pin, so a healthy 0.41.0 boot spawns nothing, a build the user put there (checkout, git or zip install) is never replaced, and a 0.40.0 venv left behind by an update is brought to 0.41.0 on the next start. UNSLOTH_DISABLE_DIFFUSERS_AUTOREPAIR=1 still opts out.
  • diffusion_families.py: _UNRELEASED_MIN_DIFFUSERS is empty, so a 0.40.0 install now gets the released-version advice (update Unsloth / pip install -U 'diffusers>=0.41.0') instead of "has not been released yet" plus git troubleshooting.
  • huggingface-hub floor on Python >= 3.10 raised from 1.31.0 to 1.32.0 in the five places Unsloth Studio: raise the huggingface_hub floor to what the pinned Diffusers main build needs #11625 set it, since diffusers 0.41.0 requires huggingface-hub>=1.32.0.
  • studio-vae-seam-guard.yml installs diffusers-main.txt only when it has an active line.
  • diffusion.py, diffusion_single_file_converters.py, diffusion_comfy_quant.py: Krea 2 single files keep Studio's loader and converter (below).
  • Tests: the git-main machinery tests run against a fixture copy with the line uncommented, so that route stays covered; new tests pin the shipped files and the release-mode behaviour.

No UI change. Notebooks are unaffected: the pyproject.toml diffusers floor (>=0.39.0) is unchanged; only the studio extra's hub floor moves.

Verification

Installer and startup self-heal, simulated with the real step 11b / 11c code, the real --diffusers-main-needs-dependency-pass / --repair-diffusers-main subprocesses and the real repair_diffusers_before_imports, scratch Python 3.12 venv, base = merge base:

starting state base after update this PR after update 2nd pass installs startup self-heal on this PR
index 0.40.0 0.41.0.dev0 git build 0.41.0 0 0.40.0 -> 0.41.0, then spawns nothing
index 0.40.0, no git 0.41.0.dev0 zip build 0.41.0 0 0.40.0 -> 0.41.0, then spawns nothing
zip build of 80c7ed26 unchanged 0.41.0 0 spawns nothing
index 0.41.0 replaced by the git build 0.41.0 0 spawns nothing
0.40.0 + a recorded git-main failure (the reports' state) startup stuck on 0.40.0 0.41.0 0 0.40.0 -> 0.41.0

No failed record and no git or zip fetch on this PR in any state; huggingface_hub ends at >= 1.32.0.

Model path, B200, Studio DiffusionBackend load + render, 1024x1024, 20 steps, fixed seed, speed mode off. Base = merge base + diffusers 80c7ed26, head = this PR + diffusers 0.41.0, two fresh processes per arm:

Qwen-Image-2.1 base head head vs base
GGUF Q4_K_M loads, renders, 26.33 GiB loads, renders, 26.33 GiB pixel-identical
bf16 loads, renders, 35.71 GiB loads, renders, 35.71 GiB pixel-identical

On 0.41.0 diffusers registers the 2.1 single-file class itself, so Studio's converter steps aside (by design) and upstream's runs. Upstream leaves the one packed 1-D norm (txt_in.text_norm.weight, BF16) as raw bytes; Studio's existing post-load _dequantize_gguf_outside_linears dequantises it, and the render is identical to base.

Krea 2 single files

0.41.0 also gives Krea2Transformer2DModel its own from_single_file, so the plain ComfyUI Krea 2 file stopped taking Studio's load_original_layout_transformer (#12885). Upstream's loader keeps _keep_in_fp32_modules only at fp16, so at bf16 it rounds the file's 130 fp32 norm scales to bf16 and the render drifts from the repo load #12885 matched. Krea 2 single files now stay on Studio's loader, and Studio's own Krea 2 / HunyuanImage converters take precedence over a registry entry diffusers adds later, in both that loader and the ComfyUI int8 / fp8 loader: upstream's Krea 2 converter strips only model.diffusion_model., so files carrying model.model. or diffusion_model. would load with 92 missing weights (new parametrized test). On the three Comfy-Org files both converters give identical keys and tensors, so this is exactly the base routing.

Same B200 setup, 1024x1024, 8 steps, two fresh processes per arm:

file base head before the Krea 2 commit this PR
krea2_turbo_bf16 ref (A/A pixel-identical) LPIPS 0.2419, max pixel diff 231 pixel-identical
krea2_turbo_fp8_scaled ref (A/A LPIPS 0.0001) LPIPS 0.0001, 256/256 fp8 kept unchanged path
krea2_turbo_int8_convrot ref LPIPS 0.0001, 224/224 int8 kept unchanged path
Qwen-Image GGUF Q4_K_M ref pixel-identical pixel-identical

All 162 from diffusers... import names Studio's inference code uses resolve on 0.41.0.

Cross-platform and regression

  • Staging cross-platform (ubuntu-latest, macos-15, windows-latest): all green.
  • Full staging CI: 88 ok, 4 failed, all pre-existing: the three Core zoo legs (red on the staging main too) and test_hub_token_caller_identity.py (the same 7 failures on the merge base locally).
  • Resolver output base vs head (studio.txt + diffusers-pin.txt + constraints, darwin-arm64 with its overrides), Python 3.10 / 3.12 x Linux x86_64 / macOS arm64 / Windows x64 / Windows arm64: the only moved line is diffusers==0.40.0 -> 0.41.0.
  • Switchboard (base vs head): every diffusers class Studio's families use imports on 0.41.0 (58/58); tiny edge suites 31 pass / 0 fail over HTTP and in process; tiny matrix 20/20 (FLUX incl. int8 / fp8 / compiled, Qwen-Image-2.1 incl. int8 / low VRAM / FBCache, SDXL, Lumina2, Wan, Z-Image, SD3); jobs/sft no regression.
  • Every changed installer predicate enumerated over its mocked input space: with the git line active (the route as it will be re-enabled) 768/768 and 432/432 cells are identical to the merge base.

Tests

suite result
tests/studio/install/test_diffusers_pin.py + test_torch_probe_memoization.py 81 passed
test_diffusers_repair.py, test_diffusion_more_families.py, test_diffusion_single_file_krea2_hunyuanimage.py, test_diffusion_single_file_registry.py 127 passed, 9 skipped (no gguf package on this host)
tests/sh/test_clean_machine_notools_pinned_git.sh 44 passed
wider installer set (947 tests) and 15 backend files touching these paths no new failures vs the merge base (pre-existing: test_rocm_support.py::TestProgressStepCountMatchesTotal::test_progress_reaches_total_on_both_core_paths[*], test_diffusion_backend.py::test_mirrored_base_still_trips_the_flux2_shape_guard)

Not tested here

  • Windows / macOS Desktop end to end (the changed logic is OS-neutral Python; setup.sh / setup.ps1 are unchanged and call the same probe).
  • INT8 / FP8 pre-quantized Qwen-Image-2.1 artifacts, reference-image editing, compile speed modes, offload memory modes.
  • MiniMax-H3 renders (66 GB). Its GGUF goes to the native engine and its ComfyUI quant files use Studio's own key map, neither reads the single-file registry; a plain H3 single file could not load on 80c7ed26 at all and now takes upstream's loader.
  • MiniMax-H3 video decode: diffusers 0.41.0 (4-bit decode: no recompile from the eager setup, one output dtype under autocast, refresh the cached LoRA cast #14754) dropped the fp16 autocast around the H3 video VAE decode and no longer pins its decoder to fp32, so Studio's bf16 load now decodes in bf16 (upstream measures it as imperceptible; mean error 5.9e-4 vs 9.6e-5 for the old recipe) and the max-speed fp16_accum lever has nothing to act on there. Left as is here; loading that VAE in fp16 would restore the old numerics but needs a 66 GB render to prove.
  • 0.41.0's QwenImage21Pipeline honours a sample_sigmas config that overrides the step count; Qwen/Qwen-Image-2.1 does not set it today, which is why the renders match.
  • AMD.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-08T13:59:06.445122Z 579a28d New commits
🔒 Security Review ✅ Completed 2026-10-08T13:41:08.875563Z cfc9955 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 danielhanchen self-assigned this Oct 8, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Oct 8, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: cfc9955850

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

…l's constraints, and upgrades index prereleases
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 3a3cfbbff4

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

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 8, 2026
@danielhanchen
danielhanchen merged commit 7730160 into main Oct 8, 2026
@danielhanchen
danielhanchen deleted the studio-diffusers-0.41.0-release branch October 8, 2026 16:32
danielhanchen added a commit that referenced this pull request Oct 28, 2026
…ain commit (#15761)

Diffusers 0.42.1 is on PyPI and carries FLUX.3 Image Klein, so Studio
can go back to installing a release instead of the pinned main commit.
This mirrors #13045, which did the same for 0.41.0 and Qwen-Image-2.1.

## What changes

- `diffusers-pin.txt` now pins one release per Python floor. Diffusers
0.42.0 declares `requires-python >= 3.11`, so a single `>= 3.10` line
would leave a 3.10 host with nothing to resolve.

  | Python | Release |
  | --- | --- |
  | 3.11 and newer | `diffusers==0.42.1` |
  | 3.10 | `diffusers==0.41.0` (unchanged) |
  | 3.9 | `diffusers==0.36.0` (unchanged) |

The installers create 3.13 by default (3.12 on Intel Macs), and
`install.ps1` only accepts 3.11 to 3.13, so 3.10 and 3.9 are only
reached by pip installs and `install.sh --python`.
- The commit line in `diffusers-main.txt` is commented out. The commit
(d42ebf9c), its archive SHA-256 and the explanation all stay, so a
future unreleased model can re-pin by uncommenting one line. The whole
git / zip route (11c, `--repair-diffusers-main`,
`--prefetch-diffusers-main`, the setup fast-path probe) is kept and
already treats an all-comment file as "nothing pinned".
- `_UNRELEASED_MIN_DIFFUSERS` is empty again, because 0.42.0 exists. The
FLUX.3 minimum stays at 0.42.0, the first release that has it.
- The too-old message for a family that needs 0.42.0 or newer now
depends on the Python version:
- On 3.11 or newer it says to update Unsloth, or `pip install -U
'diffusers>=0.42.0'`.
- On 3.10 or 3.9 it says that release needs Python 3.11 and that an
update cannot install it here.

  Before this change a 3.10 user was told the release did not exist yet.
- `_PIPELINE_PROBE_FILES` keeps its FLUX.3 entries, and only the comment
changes. The startup self-heal only replaces index installs. A host that
still has the d42ebf9c build (which reports 0.41.0.dev0) keeps FLUX.3
until its next update instead of losing it to a version comparison.
- Comment-only updates: the installer comments that assumed a main build
counts as current, the `overrides-darwin-arm64.txt` hub floor note
(0.42.1 declares the same `huggingface-hub>=1.32.0`), and the FLUX.3
forward digest note.

## Why

- d42ebf9c is an ancestor of v0.42.1, so the release is a superset of
what Studio ran: FLUX.3 Image Klein (huggingface/diffusers#15046) and
the prompt upsampler block (#15058) are both in it.
- 0.42.1 differs from 0.42.0 by a single fix. Library names read from
`model_index.json` / `modular_model_index.json` are no longer imported
unless they are a known loadable library or a `diffusers.pipelines`
module. Without that fix, a repository on `sys.path` could run its own
code on `from_pretrained()`.
- Installing from PyPI also takes git and github.com out of the default
install path again.

## Upgrade path for existing installs

- **Hosts with the d42ebf9c git or zip build** (0.41.0.dev0 plus a
`direct_url.json`): `_diffusers_release_behind` reads that as 0.41.0,
which is behind 0.42.1. The setup fast-path probe therefore forces the
dependency pass. The release step is no longer superseded, because no
main build is pinned, so it installs 0.42.1. A uv dry run of the new pin
file in an environment holding that build reports `-
diffusers==0.41.0.dev0 (from git+...@d42ebf9c...)`, `+
diffusers==0.42.1`.
- **Index installs of 0.41.0 on Python 3.11 or newer** are now behind
the pin. They are moved by the next update, or by the startup release
repair.
- **The startup repair leaves git, zip and checkout builds alone**, as
before (#13045), so the d42ebf9c build stays until `unsloth studio
update` or a desktop update.
- **Python 3.10 and 3.9 hosts** see no change.

## Tests

- **Pin tests** (`tests/studio/install/test_diffusers_pin.py`):
  - The pin file must contain exactly these three lines.
- New: a parametrized test evaluates the markers for Python 3.9, 3.10,
3.11, 3.13 and 3.14 and checks that each gets exactly one release.
- The shipped main pin is commented out but keeps its 40-character
commit and exactly one digest.
  - The retired FLUX.3 commit and digest are still in the file.
- The fast-path and repair tests now treat 0.42.1 as current, and 0.42.0
and 0.41.0 as behind.
- New: the d42ebf9c git or zip build forces the dependency pass and does
not supersede the release step. This fails on main.
- **Repair tests** (`studio/backend/tests/test_diffusers_repair.py`):
  - The shipped main pin is inactive.
- A current 0.42.1 starts nothing, and a 0.41.0 index install is behind.
  - New: the startup repair leaves the retired git build for the update.
- **FLUX.3 gate tests**
(`studio/backend/tests/test_diffusion_flux3.py`):
  - 0.42.0 is no longer in the unreleased set.
- On 3.12, a 0.41.0 install is told to update and given the pip command.
- On 3.10 and 3.9 the message names the Python 3.11 requirement, with no
pip, archive or "not released yet" text.

Real installs, CPU only:

- **Imports:** with diffusers 0.42.1 (Python 3.11, transformers 5.5.0),
`Flux3ModularPipeline`, `Flux3DistilledModularPipeline`,
`QwenImage21Pipeline`, `Flux2Pipeline` and `Flux2KleinPipeline` all
import.
- **Tiny-config forward:** the `Flux3Transformer2DModel` config from
diffusers' own model test (1 + 1 layers, 16-dim heads) runs with and
without image conditioning. It produces bit-identical output on 0.42.1
and on d42ebf9c with the same seed.
- **Family availability:** with Studio's family table on 0.42.1, every
family is selectable, including both FLUX.3 Klein variants and
Qwen-Image-2.1. On a real Python 3.10 environment built from the new pin
file (which resolves to 0.41.0), both FLUX.3 families are unavailable
and the refusal names Python 3.11.
- **Source guards:** every Studio guard that replaces or patches
diffusers code gives the same verdict on 0.42.1 as on d42ebf9c. That
covers:
  - the FLUX.3 forward digest
  - the Qwen-Image-2.1 fast-step and RoPE digests
  - the Qwen RoPE, Z-Image fused and Wan fused digests
  - FLUX.3 prompt-upsampler removal
  - LTX-2 import compat
  - FBCache source checks
  - the hires timestep rule

None of the diffusers files those guards read changed between the two
refs. All 120 `from diffusers ... import` statements in Studio's backend
resolve the same way on both. `dispatch_attention_fn` gained one line,
so its flash re-time fingerprint changes. That fingerprint already
includes the diffusers version, so the only effect is one re-time on
first use.

Suites, base (this branch's merge base) vs head, compared by failing
test IDs:

| Suite | Environment | Base | Head |
| --- | --- | --- | --- |
| `studio/backend/tests/test_diffusion*.py` + `test_video*.py` | Python
3.11, base on d42ebf9c, head on 0.42.1 | 19856 passed, 303 failed, 26
errors | 19857 passed, 303 failed, 26 errors |
| `tests/studio/install` | same | 9421 passed, 23 failed, 2 errors |
9430 passed, 23 failed, 2 errors |
| `studio/backend/tests/test_diffusion*.py` + `test_video*.py` | Python
3.13, no importable diffusers | 16602 passed, 400 failed, 119 errors |
16603 passed, 400 failed, 119 errors |
| `tests/studio/install` | same | 10221 passed, 25 failed | 10230
passed, 25 failed |

The failing test IDs are identical between base and head in every row.
These failures are already on main and come from this CPU-only host and
missing optional packages (`test_video_backend.py`,
`test_diffusion_offload_precision.py`, `test_diffusion_unified_edit.py`,
and the like). They are not from this change. Running the head test
files against base code fails 22 tests (15 pin, 2 repair, 3 FLUX.3 gate,
plus 2 FLUX.3 checkpoint tests that already fail on main). Those are the
ones that cover the new state.

## Not covered

- No GPU runs. Image quality and speed of FLUX.3, Qwen-Image-2.1 and the
patched kernels on 0.42.1 were not rendered or timed. Only the gates
that decide whether those paths engage were checked.
- Diffusers 0.42.1 changes how FLUX.3 preprocesses a single reference
image. It is now reflect-padded to the 16-pixel grid instead of
center-cropped, and with no size given the output is cropped back to the
reference's size. Studio resizes references to about 1 MP first, so the
difference should be small, but single-reference edits were not
re-rendered against d42ebf9c.
- The 0.42.1 library-name rule was checked against the cached Studio
model indexes and the MiniMax-H3 / Music 3 modular indexes (only
`diffusers` and `transformers` appear). Other catalog repos were not
fetched.
- Windows and macOS installers were not run. Their Python choices were
read from `install.ps1` and `install.sh`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Unsloth Desktop Qwen Image 2.1 Fails with "diffusers 0.40.0" Error

1 participant