invoke-ai/InvokeAI · warning · NotAMatchError

state dict looks like GGUF quantized

Error message

state dict looks like GGUF quantized

What it means

NotAMatchError raised by Qwen3Encoder._validate_does_not_look_like_gguf_quantized (qwen3_encoder.py:257). The state dict contains GGML/quantized tensor formats (ggml-prefixed or quantized block tensors), so the unquantized Qwen3 encoder config rejects it — GGUF-quantized models must be handled by the GGUF-specific configs/loaders.

Source

Thrown at invokeai/backend/model_manager/configs/qwen3_encoder.py:257

        # post-attention / post-feedforward norms a Qwen3 encoder never has; they must be classified as
        # Gemma2Encoder (otherwise a Gemma GGUF matches both configs and can be re-identified wrongly).
        if _has_gemma2_keys(state_dict):
            raise NotAMatchError(
                "state dict looks like a Gemma-2 encoder (has post_attention_norm/post_ffw_norm keys), "
                "not a Qwen3 encoder"
            )
        # Reject Qwen2.5-VL / Qwen2-VL encoders: they carry a visual tower and must be
        # classified as QwenVLEncoder (text-only Qwen3 encoders never have one).
        if _has_qwen_vl_visual_tower(state_dict):
            raise NotAMatchError(
                "state dict bundles a Qwen-VL visual tower; this is a Qwen-VL encoder, not a text-only Qwen3 encoder"
            )

    @classmethod
    def _validate_does_not_look_like_gguf_quantized(cls, mod: ModelOnDisk) -> None:
        has_ggml = _has_ggml_tensors(mod.load_state_dict())
        if has_ggml:
            raise NotAMatchError("state dict looks like GGUF quantized")


# Transformers architectures the unquantized Qwen3 encoder config accepts.
_QWEN3_ENCODER_ARCHITECTURES = {
    "Qwen2VLForConditionalGeneration",
    "Qwen2ForCausalLM",
    "Qwen3ForCausalLM",
}

# Architectures the SDNQ Qwen encoder loaders can actually instantiate. Both the standalone
# Qwen3EncoderSDNQLoader and the FLUX.2 / Z-Image pipeline loaders reconstruct a text-only
# Qwen3Config + Qwen3ForCausalLM from the state dict, so they can only load a Qwen3 model: a Qwen2
# state dict lacks Qwen3-specific parameters (q/k normalization), and a Qwen-VL state dict also
# carries visual-tower weights. Accepting those classes during identification produces folders the
# loader's strict incomplete-load guard would reject, so the SDNQ paths must narrow to this set.
_SDNQ_LOADABLE_QWEN_ARCHITECTURES = {"Qwen3ForCausalLM"}

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Use the GGUF-quantized Qwen3 encoder config/loader (e.g. Qwen3Encoder GGUF config) or install the model specifying the GGUF format explicitly.
  2. Download the unquantized safetensors version of the model if you want the plain Qwen3Encoder path.
  3. If the folder mixes formats, keep GGUF files in their own directory and rescan.
  4. Verify tensor names with gguf-dump/safetensors inspector to confirm which variant the file actually is.

Example fix

// before
model/qwen3-encoder/  // contains qwen3-encoder-Q8_0.gguf, scanned as unquantized Qwen3Encoder
// after
install qwen3-encoder-Q8_0.gguf as GGUF-quantized encoder, or download the safetensors (unquantized) revision
Defensive patterns

Strategy: validation

Validate before calling

def is_gguf_quantized(path) -> bool:
    return any(f.suffix == '.gguf' for f in path.rglob('*'))

Type guard

def has_ggml_tensors(state_dict: dict) -> bool:
    QUANT_DTYPES = {'Q4_K', 'Q5_K', 'Q6_K', 'Q8_0', 'Q4_0'}
    return any(t.dtype in QUANT_DTYPES or 'ggml' in str(t.dtype).lower() for t in state_dict.values())

Try / catch

try:
    register_model(path, model_type='Qwen3Encoder')  # unquantized
except NotAMatchError:
    register_model(path, model_type='Qwen3Encoder', format='GGUF')  # quantized loader

Prevention

When it happens

Trigger: from_model_on_disk identification where _has_ggml_tensors(mod.load_state_dict()) is true — i.e. the folder's weights are GGUF-quantized (e.g. Q8_0/Q4_K tensors) but the unquantized Qwen3Encoder config is probing it.

Common situations: Installing a GGUF-quantized Qwen3 encoder while expecting the plain (unquantized) Qwen3Encoder loader to handle it; mixed formats inside one model directory; a download that fetched the GGUF variant instead of safetensors.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/04c778282797bfcf. Report an issue: GitHub.