invoke-ai/InvokeAI · warning · NotAMatchError

state dict does not look like GGUF quantized

Error message

state dict does not look like GGUF quantized

What it means

Main_GGUF_FLUX_Config._validate_looks_like_gguf_quantized checks whether the loaded state dict contains any GGMLTensor instances (_has_ggml_tensors). If every tensor is a regular torch.Tensor, the file is not a GGUF quantization and NotAMatchError is raised. The config only accepts quantized GGUF files; unquantized checkpoints belong to other config classes.

Source

Thrown at invokeai/backend/model_manager/configs/main.py:859

        if variant is None:
            # TODO(psyche): Should we have a graceful fallback here? Previously we fell back to the "normal" variant,
            # but this variant is no longer used for FLUX models. If we get here, but the model is definitely a FLUX
            # model, we should figure out a good fallback value.
            raise NotAMatchError("unable to determine model variant from state dict")

        return variant

    @classmethod
    def _validate_looks_like_main_model(cls, mod: ModelOnDisk) -> None:
        has_main_model_keys = _has_main_keys(mod.load_state_dict())
        if not has_main_model_keys:
            raise NotAMatchError("state dict does not look like a main model")

    @classmethod
    def _validate_looks_like_gguf_quantized(cls, mod: ModelOnDisk) -> None:
        has_ggml_tensors = _has_ggml_tensors(mod.load_state_dict())
        if not has_ggml_tensors:
            raise NotAMatchError("state dict does not look like GGUF quantized")

    @classmethod
    def _validate_is_not_flux2(cls, mod: ModelOnDisk) -> None:
        """Validate that this is NOT a FLUX.2 model."""
        state_dict = mod.load_state_dict()
        if _is_flux2_model(state_dict):
            raise NotAMatchError("model is a FLUX.2 model, not FLUX.1")


class Main_GGUF_Flux2_Config(Checkpoint_Config_Base, Main_Config_Base, Config_Base):
    """Model config for GGUF-quantized FLUX.2 checkpoint models (e.g. Klein)."""

    base: Literal[BaseModelType.Flux2] = Field(default=BaseModelType.Flux2)
    format: Literal[ModelFormat.GGUFQuantized] = Field(default=ModelFormat.GGUFQuantized)

    variant: Flux2VariantType = Field()

    @classmethod

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Ensure the file is a genuine GGUF quantization from a trusted release; re-download and check the hash.
  2. Install/repair the GGUF support dependencies (e.g. the gguf package) so GGMLTensor instances are produced on load.
  3. If the model is fp16/fp8 safetensors, import it as a regular checkpoint model instead.
  4. Update InvokeAI if the GGUF format variant is newer than the loader supports.

Example fix

// before: mislabeled file
mv flux1-dev.safetensors flux1-dev.gguf   # still plain tensors -> NotAMatchError
// after: use the real quantized release
# download flux1-dev-Q4_K_S.gguf and import it
Defensive patterns

Strategy: validation

Validate before calling

import struct

def is_gguf_file(path):
    with open(path, "rb") as f:
        return f.read(4) == b"GGUF"

if not is_gguf_file("model.gguf"):
    print("renamed safetensors, not GGUF - import as a regular checkpoint")

Type guard

def is_gguf_quantized_state_dict(sd: dict) -> bool:
    from invokeai.backend.quantization.gguf import GGMLTensor
    return any(isinstance(v, GGMLTensor) for v in sd.values())

Try / catch

try:
    cfg = Main_GGUF_FLUX_Config.from_model_on_disk(mod)
except NotAMatchError:
    cfg = Main_Checkpoint_FLUX_Config.from_model_on_disk(mod)  # plain checkpoint path

Prevention

When it happens

Trigger: from_model_on_disk on a plain (non-GGUF) safetensors FLUX checkpoint, or a GGUF file loaded by a runtime lacking GGML tensor support (gguf/quantization dependency missing so tensors decode as plain tensors), or fake/mislabeled .gguf files.

Common situations: Downloading the fp16 FLUX checkpoint renamed with a .gguf extension; older InvokeAI installs without the GGUF loader dependency; community files that are actually re-packaged safetensors.

Related errors


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