fishaudio/fish-speech · critical · ValueError

Unknown model type: {data['model_type']}

Error message

Unknown model type: {data['model_type']}

What it means

BaseModelArgs.from_pretrained dispatches on the model_type field of the config and raises when it matches neither 'naive', 'dual_ar', nor 'fish_qwen3_omni'. The value comes from the model directory's config (usually fish_config.json / config.yaml).

Source

Thrown at fish_speech/models/text2semantic/llama.py:93

    @staticmethod
    def from_pretrained(path: str):
        path = Path(path)

        if path.is_dir():
            path = path / "config.json"

        with open(path, "r", encoding="utf-8") as f:
            data = json.load(f)

        match data["model_type"]:
            case "naive":
                cls = NaiveModelArgs
            case "dual_ar":
                cls = DualARModelArgs
            case "fish_qwen3_omni":
                return BaseModelArgs._from_fish_qwen3_omni(data)
            case _:
                raise ValueError(f"Unknown model type: {data['model_type']}")

        # Filter out unexpected keyword arguments
        valid_keys = {f.name for f in dataclasses.fields(cls)}
        data = {k: v for k, v in data.items() if k in valid_keys}

        return cls(**data)

    @staticmethod
    def _from_fish_qwen3_omni(data: dict) -> "DualARModelArgs":
        tc = data["text_config"]
        adc = data["audio_decoder_config"]
        flat = dict(
            model_type="dual_ar",
            vocab_size=tc["vocab_size"],
            n_layer=tc["n_layer"],
            n_head=tc["n_head"],
            n_local_heads=tc.get("n_local_heads", -1),
            head_dim=tc.get("head_dim"),

View on GitHub (pinned to befe400174)

Solutions

  1. Check model_type in the model's config file and correct typos (valid: naive, dual_ar, fish_qwen3_omni)
  2. Upgrade fish-speech to a version supporting the checkpoint's architecture
  3. Re-export the model from a matching fish-speech version
Defensive patterns

Strategy: validation

Validate before calling

import json
cfg = json.load(open(model_dir / "config.yaml"))
assert cfg["model_type"] in {"naive", "dual_ar", "fish_qwen3_omni"}, cfg["model_type"]

Try / catch

try:
    model = BaseTransformer.from_pretrained(path)
except ValueError as e:
    if "Unknown model type" in str(e):
        raise RuntimeError(f"Upgrade fish-speech to load {path}") from e
    raise

Prevention

When it happens

Trigger: Loading a checkpoint whose config has a model_type string not supported by the installed fish-speech version (e.g. an older config naming or a new architecture on an older install).

Common situations: Loading third-party or fine-tuned checkpoints; upgrading/downgrading fish-speech while reusing old model directories; hand-edited configs.

Related errors


AI-assisted analysis of fishaudio/fish-speech@befe400174 (2026-08-27). Data as JSON: /api/errors/000e6d185fb47072. Report an issue: GitHub.