invoke-ai/InvokeAI · info · NotAMatchError

state dict does not look like a T5 encoder (no 'enc.blk.*' k

Error message

state dict does not look like a T5 encoder (no 'enc.blk.*' keys)

What it means

NotAMatchError from raise_if_doesnt_look_like_t5_encoder (GGUF T5 config). llama.cpp T5 encoders prefix transformer blocks with `enc.` (`enc.blk.*`) and end with `enc.output_norm.weight`; a state dict lacking both patterns is not a T5 encoder (e.g. decoder-only GGUF models like Qwen3 use bare `blk.*`), so the config declines.

Source

Thrown at invokeai/backend/model_manager/configs/t5_encoder.py:227

        raise_if_not_file(mod)

        raise_for_override_fields(cls, override_fields)

        cls.raise_if_doesnt_look_like_t5_encoder(mod)

        cls.raise_if_doesnt_look_like_gguf_quantized(mod)

        return cls(**override_fields)

    @classmethod
    def raise_if_doesnt_look_like_t5_encoder(cls, mod: ModelOnDisk) -> None:
        # llama.cpp T5 encoders use the ``enc.`` prefix on their transformer blocks and final norm. This
        # distinguishes them from decoder-only GGUF models (e.g. Qwen3, which uses bare ``blk.*``).
        state_dict = mod.load_state_dict()
        if not state_dict_has_any_keys_starting_with(
            state_dict, "enc.blk."
        ) and not state_dict_has_any_keys_ending_with(state_dict, "enc.output_norm.weight"):
            raise NotAMatchError("state dict does not look like a T5 encoder (no 'enc.blk.*' keys)")

    @classmethod
    def raise_if_doesnt_look_like_gguf_quantized(cls, mod: ModelOnDisk) -> None:
        has_ggml = any(isinstance(v, GGMLTensor) for v in mod.load_state_dict().values())
        if not has_ggml:
            raise NotAMatchError("state dict does not look like GGUF quantized")

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Download the correct T5 encoder gguf conversion (e.g. city96/t5-v1_1-xxl-encoder-gguf)
  2. Rescan pointing at the right file if you meant a different model type; register non-T5 gguf under its proper config
  3. Verify with gguf metadata that the architecture is t5encoder before installing

Example fix

// before
model = Qwen3-4B-Q4_K_M.gguf      # keys: blk.0.attn...
// after
model = t5-v1_1-xxl-encoder-Q5_K_M.gguf  # keys: enc.blk.0.attn...
Defensive patterns

Strategy: validation

Validate before calling

def looks_like_t5_encoder_gguf(gguf_path) -> bool:
    from invokeai.backend.quantization.gguf import load_gguf_state_dict
    sd = load_gguf_state_dict(gguf_path)
    return any(k.startswith("enc.blk.") for k in sd) or any(k.endswith("enc.output_norm.weight") for k in sd)

Try / catch

try:
    install_model(path)
except NotAMatchError as e:
    if "enc.blk" in str(e):
        logger.error("GGUF file is not a T5 encoder (decoder-only LLM?); download t5-*-encoder-gguf")

Prevention

When it happens

Trigger: from_model_on_disk on a .gguf file whose state dict has no keys starting with 'enc.blk.' and none ending with 'enc.output_norm.weight' — decoder-only LLM gguf files, wrong-layer gguf conversions, or non-T5 architectures.

Common situations: Pointing the scan at a Qwen3/LLaMA gguf file, downloading the decoder (t5-v1_1-xxl) instead of the encoder gguf, or using gguf conversions of non-T5 encoders.

Related errors


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