Repository navigation
Studio: keep Qwen-Image's bf16 text encoder automatically when the card has room - #16678
Conversation
|
@codex review |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 386c85583d
ℹ️ 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".
| te_quant_planned, _ = resolve_te_quant_request( | ||
| kwargs.get("text_encoder_quant"), getattr(fam, "te_quant_auto", None) | ||
| "none" if te_bf16_auto else kwargs.get("text_encoder_quant"), | ||
| getattr(fam, "te_quant_auto", None), |
There was a problem hiding this comment.
Apply the bf16 auto decision to the public download plan
For a default Qwen-Image load on a card where this upgrade engages, download_plan() still resolves the unset request to int8 and excludes the dense encoder shards. The Images page calls /images/download-plan and stages its returned files before loading, so a fresh download fetches the unused int8 encoder, then _run_load unexpectedly downloads the dense encoder as well. This also makes Download only omit the encoder that the subsequent online load needs. Share this decision with download_plan() so its file list and byte estimates describe the actual load.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0bbba69: download_plan now makes the same bf16 auto decision as the load (same room check, same supplied-component and probe guards), so the plan stages the encoder the load will open (test_download_plan_stages_the_encoder_the_load_will_open).
…s the load The Images page stages /images/download-plan before it loads; with the plan still resolving the unset request to int8, a fresh download fetched the unused int8 encoder and the load then pulled the dense one. [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
Summary
Qwen-Image's automatic text encoder is the int8 ConvRot file. Over 16 prompts it is most of the gap between Studio's default and a bf16 reference (LPIPS 0.0865 mean, 0.401 worst prompt); the denoiser path alone sits near the bf16 floor. On a card where the denoiser stays resident with room to spare, those 6 GiB of VRAM are otherwise idle.
This keeps the bf16 text encoder automatically for an unset Qwen-Image request when the whole load, with the bf16 encoder, stays resident on one card with a margin. Otherwise the int8 encoder is used as today.
Change
diffusion_precision.py:te_bf16_auto_wanted(unset orautorequest, aqwen-imagefull-pipeline load, family auto pick int8) andte_bf16_auto_fits(nothing offloaded or streamed, one discrete card, required memory + max(512 MiB, 10%) within the safe budget).diffusion.py:_run_loaddecides before the download plan (the int8 path skips the dense encoder shards). The load is priced with the bf16 encoder on the denoiser the plan would pick, crediting this process's own reservation as free. When it engages, the load status says why.none,off,int8,fp8) always win. Offline loads, user-supplied encoder components and GGUF / single-file loads are excluded. Kill switchUNSLOTH_DIFFUSION_TE_BF16_AUTO=0.tests/test_diffusion_te_bf16_auto.py: 31 tests (decision tables plus the real planners: a bf16 denoiser engages on 96 / 80 GiB and declines on 64 / 24; the int8 denoiser engages on 96 / 64 and declines on 56 / 24).Evidence
G4 (RTX PRO 6000), Qwen-Image, 16 prompts, LPIPS against Studio's own bf16 reference:
nonenone(same image hashes); repeats of every arm are identical. Host RAM is unchanged.Tests
test_diffusion_te_bf16_auto.py: 31 passed here; all 31 error on main (the helpers do not exist there).Not covered