feat(mm): add Qwen Image single-file checkpoint loader with fp8 support#9253
Open
Pfannkuchensack wants to merge 2 commits into
Open
feat(mm): add Qwen Image single-file checkpoint loader with fp8 support#9253Pfannkuchensack wants to merge 2 commits into
Pfannkuchensack wants to merge 2 commits into
Conversation
…h fp8 support Adds Main_Checkpoint_QwenImage_Config and QwenImageCheckpointModel so that single-file safetensors checkpoints (e.g. Qwen-Image-Edit 2511 fp8_scaled from Civitai) can be imported. ComfyUI-style fp8 weights are dequantized to bf16 at load time; the existing default_settings.fp8_storage toggle then optionally re-casts to fp8 for VRAM savings. Also wires _apply_fp8_layerwise_casting into the Qwen Image diffusers loader so the fp8 storage option works across all three formats (diffusers, single- file checkpoint, GGUF stays untouched as it carries its own quantization). Shared variant inference (marker tensor → filename heuristic) and transformer architecture auto-detection are extracted into module-level helpers so the GGUF and checkpoint loaders stay in sync.
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
Adds
Main_Checkpoint_QwenImage_ConfigandQwenImageCheckpointModelso that single-file safetensors checkpoints (e.g. Qwen-Image-Edit 2511 fp8_scaled from Civitai) can be imported. ComfyUI-style fp8 weights are dequantized to bf16 at load time; the existingdefault_settings.fp8_storagetoggle then optionally re-casts to fp8 for VRAM savings.Also wires
_apply_fp8_layerwise_castinginto the Qwen Image diffusers loader so the fp8 storage option works across all three formats (diffusers, single-file checkpoint; GGUF stays untouched as it carries its own quantization).Shared variant inference (marker tensor → filename heuristic) and transformer architecture auto-detection are extracted into module-level helpers so the GGUF and checkpoint loaders stay in sync.
Related Issues / Discussions
Qwen-Image-Edit 2511 fp8_scaled.
QA Instructions
Suggested test files:
Main/QwenImage/Checkpoint(notDiffusers, notGGUFQuantized) and that the variant (editvsgenerate) is inferred correctly:edit__index_timestep_zero__→editgenerateFP8 layerwise casting enabled for <model> ...should appear.Merge Plan
Standard merge — no DB schema changes, no migrations needed. The new config class registers in the discriminator union but only matches files that are explicitly Qwen Image single-file checkpoints (not GGUF, not diffusers), so it cannot accidentally re-classify existing models.
I did not test it yet. Need to make some space for it.
Checklist
What's Newcopy (if doing a release after this PR)