{"record":{"id":"76165576b99503df","repo":"invoke-ai/InvokeAI","slug":"state-dict-does-not-look-like-a-t5-encoder-no-en","errorCode":null,"errorMessage":"state dict does not look like a T5 encoder (no 'enc.blk.*' keys)","messagePattern":"state dict does not look like a T5 encoder \\(no 'enc\\.blk\\.\\*' keys\\)","errorType":"validation","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/t5_encoder.py","lineNumber":227,"sourceCode":"        raise_if_not_file(mod)\n\n        raise_for_override_fields(cls, override_fields)\n\n        cls.raise_if_doesnt_look_like_t5_encoder(mod)\n\n        cls.raise_if_doesnt_look_like_gguf_quantized(mod)\n\n        return cls(**override_fields)\n\n    @classmethod\n    def raise_if_doesnt_look_like_t5_encoder(cls, mod: ModelOnDisk) -> None:\n        # llama.cpp T5 encoders use the ``enc.`` prefix on their transformer blocks and final norm. This\n        # distinguishes them from decoder-only GGUF models (e.g. Qwen3, which uses bare ``blk.*``).\n        state_dict = mod.load_state_dict()\n        if not state_dict_has_any_keys_starting_with(\n            state_dict, \"enc.blk.\"\n        ) and not state_dict_has_any_keys_ending_with(state_dict, \"enc.output_norm.weight\"):\n            raise NotAMatchError(\"state dict does not look like a T5 encoder (no 'enc.blk.*' keys)\")\n\n    @classmethod\n    def raise_if_doesnt_look_like_gguf_quantized(cls, mod: ModelOnDisk) -> None:\n        has_ggml = any(isinstance(v, GGMLTensor) for v in mod.load_state_dict().values())\n        if not has_ggml:\n            raise NotAMatchError(\"state dict does not look like GGUF quantized\")\n","sourceCodeStart":209,"sourceCodeEnd":234,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/t5_encoder.py#L209-L234","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Download the correct T5 encoder gguf conversion (e.g. city96/t5-v1_1-xxl-encoder-gguf)","Rescan pointing at the right file if you meant a different model type; register non-T5 gguf under its proper config","Verify with gguf metadata that the architecture is t5encoder before installing"],"exampleFix":"// before\nmodel = Qwen3-4B-Q4_K_M.gguf      # keys: blk.0.attn...\n// after\nmodel = t5-v1_1-xxl-encoder-Q5_K_M.gguf  # keys: enc.blk.0.attn...","handlingStrategy":"validation","validationCode":"def looks_like_t5_encoder_gguf(gguf_path) -> bool:\n    from invokeai.backend.quantization.gguf import load_gguf_state_dict\n    sd = load_gguf_state_dict(gguf_path)\n    return any(k.startswith(\"enc.blk.\") for k in sd) or any(k.endswith(\"enc.output_norm.weight\") for k in sd)","typeGuard":null,"tryCatchPattern":"try:\n    install_model(path)\nexcept NotAMatchError as e:\n    if \"enc.blk\" in str(e):\n        logger.error(\"GGUF file is not a T5 encoder (decoder-only LLM?); download t5-*-encoder-gguf\")","preventionTips":["Check gguf metadata architecture == t5encoder before download","Don't confuse t5 decoder ggufs with encoder ggufs","Keep encoder ggufs in clearly named files/folders"],"tags":["gguf","t5","state-dict"],"backgroundTag":"quantization-format-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}