Skip to content

Fix Ming-Image GGUF packed QKV loading - #484

Open
RealRebelAI wants to merge 1 commit into
city96:mainfrom
RealRebelAI:fix/ming-image-gguf-qkv
Open

RealRebelAI wants to merge 1 commit into
city96:mainfrom
RealRebelAI:fix/ming-image-gguf-qkv

Conversation

@RealRebelAI

Copy link
Copy Markdown

Summary

Adds Ming-Image GGUF support for quantized Diffusers-format checkpoints that store attention Q/K/V as separate tensors.

ComfyUI's normal Diffusers conversion merges those tensors using ordinary Torch tensor assignment. With quantized GGUF tensors, the underlying physical storage is packed bytes while the GGMLTensor keeps a separate logical tensor shape. This can cause the packed row width to be used during the merge instead of the logical width.

For Ming-Image-0.1-Design this produced:

The expanded size of the tensor (3840) must match the existing size (4080)
Target sizes: [3840, 3840]
Tensor sizes: [3840, 4080]

Fix

When UnetLoaderGGUF detects a quantized Ming-Image state dict, it performs the Ming Diffusers key conversion before ComfyUI's generic model conversion.

The Q/K/V merge:

  • keeps the tensors quantized
  • concatenates their packed GGUF storage directly
  • preserves the GGML quantization type
  • preserves the correct logical tensor shape
  • preserves is_largest_weight when present

The GGUF model itself does not need to be rebuilt, repaired, dequantized, or requantized.

Tested

Tested successfully with:

  • Ming-Image-0.1-Design
  • mixed GGUF with BF16 / Q8_0 / Q6_K / Q4_K tensors
  • ComfyUI 0.37.0
  • ComfyUI-GGUF
  • Windows portable ComfyUI
  • RTX 3070 8 GB
  • --lowvram

Before the change the same GGUF failed during convert_diffusers_mmdit() with the 3840 vs 4080 shape mismatch.

After the change the original GGUF loads successfully and runs without modifying the model file.

Scope

This is deliberately detected using Ming-Image-specific tensor keys rather than changing GGMLTensor behavior globally.

Ming currently shares ComfyUI's z_image_to_diffusers() key mapping internally, but this change is specifically scoped and named for Ming-Image because that is the model and path tested here.

@RealRebelAI

Copy link
Copy Markdown
Author

id also like to add that i have quants uploading for the model for anyone interested. theyll be in my HF repo.

@abdulraheem81

abdulraheem81 commented Sep 24, 2026 •

Copy link
Copy Markdown

ComfyUI-GGUF-db80272b3d04f4747a4df00cb0a7ca95f63ec490.zip
I make it work completely in Macos test it Error AttributeError: type object 'GGMLOps' has no attribute' MoEExperts' fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants