fix(mm): identify Qwen2.5/Qwen3 causal LMs as Text LLM, not Qwen3 encoder - #9097
Merged
lstein merged 9 commits intoMay 5, 2026
Merged
Conversation
…oder `Qwen3Encoder_Qwen3Encoder_Config` matches any directory with `config.json` at the root and a Qwen* class name, which also describes a complete causal LM like `Qwen2.5-1.5B-Instruct`. With both configs matching and equal sort keys, the encoder won the tie-break, blocking the model from being used as a prompt expander. A standalone text_encoder download has no tokenizer files; a complete causal LM does. Use that to reject the encoder match when tokenizer files are present alongside `config.json` at the root. Also fixes the secondary failure when manually switching the type from `Qwen3Encoder` to `Text LLM`: the existing record's `format=qwen3_encoder` and `variant` were carried over and produced no matching discriminator under `text_llm`. On `ValidationError` after a type change, retry with the stale fields stripped so the new class can apply its defaults. Closes invoke-ai#9090
Pfannkuchensack
requested review from
JPPhoto,
blessedcoolant,
dunkeroni and
lstein
as code owners
April 30, 2026 12:57
Closed
1 task
Collaborator
|
Identification and reidentification are working properly. Just a note on the secondary bug, that when I install Qwen2.5-1.5B-Instruct before applying the PR, apply the PR, and then try to change its type without also changing its format, I get this error: I have to change the Model Format to |
Member
Author
|
Yes, the Format of that Model is diffusers. |
…sent The Expand Prompt (sparkle) and Image-to-Prompt buttons used to disappear entirely when no Text LLM or LLaVA model was installed, leaving users no way to discover the feature exists. Both buttons now stay visible at all times. Clicking them with no suitable model installed opens a popover that: - explains what kind of model the feature needs - recommends a default (Qwen2.5-1.5B-Instruct for prompt expansion, LLaVA Onevision 0.5B for image-to-prompt) - offers an "Open Model Manager" button that jumps straight to the Starter Models sub-tab (mirrors the useStarterModelsToast flow, but skips the Launchpad detour since we already know which models the user needs). Tooltip labels also reflect the missing-model state. Adds four starter models so the recommended setups are one click away: - Qwen2.5-1.5B-Instruct (~3 GB) — recommended Text LLM default - Qwen2.5-3B-Instruct (~6 GB) — higher quality Text LLM - SmolLM2-1.7B-Instruct (~3 GB) — Apache-2.0 Text LLM alternative - LLaVA Onevision Qwen2 7B (~16 GB) — larger LLaVA option alongside the existing 0.5B starter
…hub.com/Pfannkuchensack/InvokeAI into fix/qwen3-encoder-misidentifies-textllm
Member
Author
lstein
enabled auto-merge (squash)
May 5, 2026 02:29
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.


Summary
Qwen3Encoder_Qwen3Encoder_Configmatches any directory withconfig.jsonat the root and a Qwen* class name, which also describes a complete causal LM likeQwen2.5-1.5B-Instruct. With both configs matching and equal sort keys, the encoder won the tie-break, blocking the model from being used as a prompt expander.A standalone text_encoder download has no tokenizer files; a complete causal LM does. Use that to reject the encoder match when tokenizer files are present alongside
config.jsonat the root.Also fixes the secondary failure when manually switching the type from
Qwen3EncodertoText LLM: the existing record'sformat=qwen3_encoderandvariantwere carried over and produced no matching discriminator undertext_llm. OnValidationErrorafter a type change, retry with the stale fields stripped so the new class can apply its defaults.Closes #9090
Related Issues / Discussions
text_llm#9090QA Instructions
Primary bug — probe misidentification:
Qwen/Qwen2.5-1.5B-Instruct.Secondary bug — manual type switch:
main(without this PR), installQwen2.5-1.5B-Instruct; it lands asQwen3 Encoder.Text LLM→ save.TextLLM_Diffusers_Config. Previously this returned "Model Update Failed".Regression checks:
text_encodersubfolder bundled with a Z-Image / Qwen-Image pipeline) — should still be identified asQwen3 Encoder.text_encoder/subfolder — unchanged behavior.pytest tests/app/services/model_records/ tests/backend/model_manager/configs/→ 31 tests pass.Merge Plan
Standard merge — no schema/migration changes, no sensitive surfaces touched. Backend-only fix.
Checklist
What's Newcopy (if doing a release after this PR)