Repository navigation
Studio: install the released Diffusers 0.41.0 instead of the pinned main commit - #13045
Conversation
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. |
… or damaged Diffusers still forces the pass
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…l's constraints, and upgrades index prereleases
|
Codex Review: Didn't find any major issues. Hooray! 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". |
…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`.
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: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
QwenImage21Pipelineand single-file support forQwenImage21Transformer2DModel.80c7ed26is an ancestor ofv0.41.0.Change
diffusers-pin.txt:diffusers==0.41.0on 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:skippedwith the labeldiffusers main (none pinned, skipped)and runs nothing;--diffusers-main-needs-dependency-passanswers "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-maininstallsdiffusers-pin.txtunder 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 newdiffusers_release_repairkey, so an old git-main failure cannot block the PyPI repair. A full update pass drops both keys;--prefetch-diffusers-mainfetches 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=1still opts out.diffusion_families.py:_UNRELEASED_MIN_DIFFUSERSis 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-hubfloor 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 requireshuggingface-hub>=1.32.0.studio-vae-seam-guard.ymlinstallsdiffusers-main.txtonly 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).No UI change. Notebooks are unaffected: the
pyproject.tomldiffusers 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-mainsubprocesses and the realrepair_diffusers_before_imports, scratch Python 3.12 venv, base = merge base:No
failedrecord and no git or zip fetch on this PR in any state;huggingface_hubends at >= 1.32.0.Model path, B200, Studio
DiffusionBackendload + render, 1024x1024, 20 steps, fixed seed, speed mode off. Base = merge base + diffusers80c7ed26, head = this PR + diffusers 0.41.0, two fresh processes per arm: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_linearsdequantises it, and the render is identical to base.Krea 2 single files
0.41.0 also gives
Krea2Transformer2DModelits ownfrom_single_file, so the plain ComfyUI Krea 2 file stopped taking Studio'sload_original_layout_transformer(#12885). Upstream's loader keeps_keep_in_fp32_modulesonly 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 onlymodel.diffusion_model., so files carryingmodel.model.ordiffusion_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:
All 162
from diffusers... importnames Studio's inference code uses resolve on 0.41.0.Cross-platform and regression
maintoo) andtest_hub_token_caller_identity.py(the same 7 failures on the merge base locally).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 isdiffusers==0.40.0 -> 0.41.0.jobs/sftno regression.Tests
tests/studio/install/test_diffusers_pin.py+test_torch_probe_memoization.pytest_diffusers_repair.py,test_diffusion_more_families.py,test_diffusion_single_file_krea2_hunyuanimage.py,test_diffusion_single_file_registry.pyggufpackage on this host)tests/sh/test_clean_machine_notools_pinned_git.shtest_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
setup.sh/setup.ps1are unchanged and call the same probe).fp16_accumlever 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.QwenImage21Pipelinehonours asample_sigmasconfig that overrides the step count;Qwen/Qwen-Image-2.1does not set it today, which is why the renders match.