Repository navigation
Studio: install the pinned Diffusers build on startup when an old installer skipped it - #11579
Merged
danielhanchen merged 8 commits intoSep 22, 2026
Merged
Conversation
…taller skipped it
…ld the gate for a peer after a timeout
shaojun
pushed a commit
to shaojun/unsloth
that referenced
this pull request
Sep 29, 2026
…taller skipped it (unslothai#11579) * Studio: install the pinned Diffusers build on startup when an old installer skipped it * Stop the installer's children when the diffusers repair times out * Start the diffusers repair before the socket binds and gate MiniMax Music 3 on it * Wait out a peer holding the pass and keep UV_OFFLINE in the repair * Leave local diffusers checkouts alone, record a failed repair, and hold the gate for a peer after a timeout * Let an explicit update retry a failed repair, and wait out a peer's pass at startup * Decide the startup repair only once no peer holds the pass * List the diffusers repair among the adopters left outside the shutdown gate
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.
An install updated from 2026.9.7 or older still needs two updates before Qwen-Image-2.1 loads. The first update runs the 2026.9.7 installer, which has no Diffusers main step, so Diffusers stays at 0.40.0 and the model refuses with "needs diffusers >= 0.41.0 (QwenImage21Pipeline)". #11566 fixes this for updates that start from 2026.9.9 or later, and its fast-path probe fixes the second update, but nothing that runs during the first update is new code.
Cause
unsloth studio updateruns the installedsetup.shandinstall_python_stack.py, so an update from 2026.9.7 runs the 2026.9.7 installer end to end. The first new code such a host runs is the backend that starts after the update.Fix
The backend repairs the install on startup, the same way
utils/mlx_repair.pyalready repairs a dropped MLX stack:utils/diffusers_repair.pyreads the diffusersdirect_url.jsonat startup. The pinned build is a git or zip direct reference, so a healthy install spawns nothing. When diffusers is an index release anddiffusers-main.txtexists, it starts one background thread per process that runsinstall_python_stack.py --repair-diffusers-main.--repair-diffusers-mainruns step 11c by itself, behind the existing gates (_diffusers_main_needs_dependency_pass: opt-out, Python 3.10, git or the zip route from Studio: install the pinned Diffusers commit from a zip when there is no git #11565, no recorded failed build) and under the pass lock, so a running update is left to install the build itself. Exit 0 means installed, 1 nothing to do, 2 failed.Opt out with
UNSLOTH_DISABLE_DIFFUSERS_AUTOREPAIR=1.UNSLOTH_DIFFUSERS_MAIN=0also disables it.Before and after
A copy of a real Studio venv (CUDA, Linux) in the state a 2026.9.7 to 2026.9.9 update leaves: unsloth 2026.9.9, Diffusers 0.40.0 from PyPI, and a manifest with no Diffusers main step. The backend was started from each wheel and asked for a Qwen-Image-2.1 plan (
POST /api/inference/images/download-plan,Qwen/Qwen-Image-2.1), with uv's cached Diffusers build cleared first.80c7ed26, installed 4.8 s after startupverify_install(deep=True)afterwardsOn this host the repair finished before the first request arrived, so the refusal shown during a running repair was exercised only by the unit test.
Tests
studio/backend/tests/test_diffusers_repair.py: 14 cases covering candidate detection (PyPI, git and zip installs), one repair per process, exit-code handling, both opt-outs, the environment allowlist, the load refusal while the repair runs, and the restart message.tests/studio/install/test_diffusers_pin.pyfor_repair_diffusers_main: installed, failed, nothing to do, and an update holding the pass lock.tests/studio/install: 7531 passed, 1631 skipped.test_qwen_image_21_gguf_reaches_sd_cpp_with_its_own_vae_and_a_qwen3vl_encoder, a GGUF filename expectation that is already red on main.Scope
unslothfrom PyPI.CREATE_NO_WINDOWon Windows and the same uv discovery as the MLX repair.