invoke-ai/InvokeAI · info · NotAMatchError

text_encoder_2 does not look like an SDNQ-quantized T5 encod

Error message

text_encoder_2 does not look like an SDNQ-quantized T5 encoder

What it means

NotAMatchError from _raise_if_not_sdnq_quantized. After locating the encoder dir, the config verifies SDNQ provenance via `quantization_config.json` with quant_method=='sdnq' or SDNQ-specific keys in the safetensors; if neither check passes, the model is not SDNQ-quantized and this config declines.

Source

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

            raise NotAMatchError("no text_encoder_2/config.json or config.json at model root")
        return te_dir

    @classmethod
    def _raise_if_not_sdnq_quantized(cls, te_dir) -> None:
        quant_config_path = te_dir / "quantization_config.json"
        if quant_config_path.exists():
            try:
                with open(quant_config_path, "r", encoding="utf-8") as f:
                    quant_config = json.load(f)
            except (OSError, ValueError):
                quant_config = {}
            if quant_config.get("quant_method") == "sdnq":
                return

        if _safetensors_dir_has_sdnq_keys(te_dir):
            return

        raise NotAMatchError("text_encoder_2 does not look like an SDNQ-quantized T5 encoder")


class T5Encoder_GGUF_Config(Checkpoint_Config_Base, Config_Base):
    """Configuration for GGUF-quantized T5 text encoder models in a single .gguf file.

    These are conversions like city96/t5-v1_1-xxl-encoder-gguf, which use llama.cpp's T5 encoder
    tensor naming (``enc.blk.N.*``, ``token_embd.weight``, ``enc.output_norm.weight``)."""

    base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)
    type: Literal[ModelType.T5Encoder] = Field(default=ModelType.T5Encoder)
    format: Literal[ModelFormat.GGUFQuantized] = Field(default=ModelFormat.GGUFQuantized)
    cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")

    @classmethod
    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
        raise_if_not_file(mod)

        raise_for_override_fields(cls, override_fields)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Re-quantize the model with SDNQ ensuring quantization_config.json (quant_method: sdnq) is saved
  2. Download a verified SDNQ conversion of the T5 encoder
  3. If the model uses another quantization, let the matching config (bnb/gguf) handle it — this rejection is expected

Example fix

// before
text_encoder_2/{config.json, model.safetensors}
// after
text_encoder_2/{config.json, model.safetensors, quantization_config.json}  # {"quant_method": "sdnq", ...}
Defensive patterns

Strategy: validation

Validate before calling

import json
def is_sdnq(te_dir) -> bool:
    qcfg = te_dir / "quantization_config.json"
    if qcfg.exists() and json.loads(qcfg.read_text()).get("quant_method") == "sdnq":
        return True
    return False

Try / catch

try:
    install_model(path)
except NotAMatchError as e:
    if "SDNQ" in str(e):
        logger.warning("Not SDNQ-quantized; selecting the matching bnb/gguf/fp16 config instead")

Prevention

When it happens

Trigger: from_model_on_disk on a T5 encoder whose te_dir lacks a valid sdnq quantization_config.json and whose safetensors contain no SDNQ keys — e.g. an fp16/bnb/gguf encoder probed against the SDNQ config.

Common situations: Models quantized with bitsandbytes, GGUF, or left unquantized; SDNQ conversions saved by tools that don't emit quantization_config.json.

Related errors


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