{"record":{"id":"5816dbbc87aa0988","repo":"invoke-ai/InvokeAI","slug":"state-dict-does-not-look-like-gguf-quantized-5816db","errorCode":null,"errorMessage":"state dict does not look like GGUF quantized","messagePattern":"state dict does not look like GGUF quantized","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/configs/qwen3_encoder.py","lineNumber":451,"sourceCode":"        # post-attention / post-feedforward norms a Qwen3 encoder never has; they must be classified as\n        # Gemma2Encoder (otherwise a Gemma GGUF matches both configs and can be re-identified wrongly).\n        if _has_gemma2_keys(state_dict):\n            raise NotAMatchError(\n                \"state dict looks like a Gemma-2 encoder (has post_attention_norm/post_ffw_norm keys), \"\n                \"not a Qwen3 encoder\"\n            )\n        # Reject Qwen2.5-VL / Qwen2-VL encoders: they carry a visual tower and must be\n        # classified as QwenVLEncoder (text-only Qwen3 encoders never have one).\n        if _has_qwen_vl_visual_tower(state_dict):\n            raise NotAMatchError(\n                \"state dict bundles a Qwen-VL visual tower; this is a Qwen-VL encoder, not a text-only Qwen3 encoder\"\n            )\n\n    @classmethod\n    def _validate_looks_like_gguf_quantized(cls, mod: ModelOnDisk) -> None:\n        has_ggml = _has_ggml_tensors(mod.load_state_dict())\n        if not has_ggml:\n            raise NotAMatchError(\"state dict does not look like GGUF quantized\")\n\n\nclass Qwen3Encoder_SDNQ_Config(Checkpoint_Config_Base, Config_Base):\n    \"\"\"Configuration for SDNQ-quantized Qwen3 Encoder models (single file).\"\"\"\n\n    base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)\n    type: Literal[ModelType.Qwen3Encoder] = Field(default=ModelType.Qwen3Encoder)\n    format: Literal[ModelFormat.SDNQQuantized] = Field(default=ModelFormat.SDNQQuantized)\n    cpu_only: bool | None = Field(default=None, description=\"Whether this model should run on CPU only\")\n    variant: Qwen3VariantType = Field(description=\"Qwen3 model size variant (4B or 8B)\")\n\n    @classmethod\n    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:\n        raise_if_not_file(mod)\n\n        raise_for_override_fields(cls, override_fields)\n\n        cls._validate_looks_like_qwen3_model(mod)","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/qwen3_encoder.py#L433-L469","documentation":"Qwen3Encoder_GGUF_Config._validate_looks_like_gguf_quantized raises NotAMatchError when the loaded state dict contains no GGML tensors, meaning the file is not GGUF-quantized. The config is exclusively for GGUF-quantized Qwen3 encoder files, so identification bails out for safetensors/binaries or other quantization formats. This typically means the wrong config was probed or the wrong file was downloaded.","triggerScenarios":"from_model_on_disk probing a non-GGUF Qwen3 file (safetensors, SDNQ, .bin) against Qwen3Encoder_GGUF_Config; _has_ggml_tensors(load_state_dict()) returns False.","commonSituations":"Renaming a safetensors file with a .gguf extension; downloading the unquantized (FP16) model while expecting a GGUF; the model manager probing every installed file against all candidate configs.","solutions":["Download the actual GGUF-quantized variant of the Qwen3 encoder (e.g. Q4_K_M / Q8_0 from the model repo's GGUF files).","If the file is safetensors/SDNQ, let it be identified by Qwen3Encoder_Checkpoint_Config or Qwen3Encoder_SDNQ_Config instead of the GGUF config.","Verify the file format (magic bytes 'GGUF') — do not merely rename non-GGUF files to .gguf."],"exampleFix":"// before: renamed safetensors\ncp model.safetensors model.gguf  # NotAMatchError: no GGML tensors\n\n// after: download real GGUF\nhuggingface-cli download repo Qwen3-4B-Encoder-Q8_0.gguf","handlingStrategy":"validation","validationCode":"def is_gguf_file(path) -> bool:\n    with open(path, 'rb') as f:\n        return f.read(4) == b'GGUF'\n\nif not is_gguf_file(mod.path):\n    raise ValueError(f'{mod.path} is not a GGUF file')","typeGuard":"def has_ggml_tensors(state_dict: dict) -> bool:\n    return any(getattr(t, 'tensor_type', None) is not None and 'ggml' in str(type(t)).lower() for t in state_dict.values())","tryCatchPattern":"try:\n    config = Qwen3Encoder_GGUF_Config.from_model_on_disk(mod)\nexcept NotAMatchError:\n    config = Qwen3Encoder_SDNQ_Config.from_model_on_disk(mod)  # non-GGUF formats","preventionTips":["Verify GGUF magic bytes / file extension before forcing the GGUF config.","Download explicitly GGUF-quantized variants (Q4_K_M, Q8_0, etc.), not fp16 safetensors.","Do not rename safetensors/bin files to .gguf.","Let the model manager probe all configs instead of hardcoding one."],"tags":["gguf","model-identification","invokeai","file-format"],"backgroundTag":"invalid-model-file-format","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}