unslothai/unsloth · error · ValueError

Unknown model_kind '{model_kind}'. Expected one of {sorted(_

Error message

Unknown model_kind '{model_kind}'. Expected one of {sorted(_MODEL_KINDS)}.

What it means

resolve_video_model_kind validates the explicit model_kind argument against _MODEL_KINDS = {'gguf', 'single_file', 'pipeline'} (case-insensitive after strip). Anything else raises ValueError before any family detection or download starts. It is the cheap gate that classifies how a video model should be loaded: diffusers pipeline repo, single .safetensors checkpoint, or GGUF quant.

Source

Thrown at studio/backend/core/inference/video.py:189

        "lightricks/ltx-2.3",
        "lightricks/ltx-2.3-fp8",
        # Wan2.2 official diffusers base repos: safetensors-only, no remote code.
        "wan-ai/wan2.2-ti2v-5b-diffusers",
        "wan-ai/wan2.2-t2v-a14b-diffusers",
        # HunyuanVideo-1.5 community Diffusers repacks (tencent's own repo has no model_index.json).
        "hunyuanvideo-community/hunyuanvideo-1.5-diffusers-480p_t2v",
        "hunyuanvideo-community/hunyuanvideo-1.5-diffusers-720p_t2v",
        "minimaxai/minimax-h3",
    }
)


def resolve_video_model_kind(gguf_filename: Optional[str], model_kind: Optional[str]) -> str:
    """Classify a load request; explicit model_kind wins, else the filename decides."""
    if model_kind:
        kind = model_kind.strip().lower()
        if kind not in _MODEL_KINDS:
            raise ValueError(
                f"Unknown model_kind '{model_kind}'. Expected one of {sorted(_MODEL_KINDS)}."
            )
        return kind
    if not gguf_filename:
        return "pipeline"
    return "gguf" if gguf_filename.strip().lower().endswith(".gguf") else "single_file"


def assert_video_precision_available(
    fam: Any,
    *,
    model_kind: str,
    transformer_quant: Optional[str] = None,
    text_encoder_quant: Optional[str] = None,
    memory_mode: Optional[str] = None,
    gpu_ordinal: Optional[int] = None,
) -> None:
    """Raise ``RuntimeError`` (the route's 409) when an EXPLICIT precision cannot run here.

View on GitHub (pinned to 203007d190)

Solutions

  1. Send one of the exact values: 'pipeline', 'gguf', or 'single_file'.
  2. Omit model_kind entirely and let the filename decide (.gguf -> 'gguf', other filename -> 'single_file', no filename -> 'pipeline').
  3. Validate against the sorted list echoed in the error message before submitting.

Example fix

# before
load_video_model(repo_id='...', gguf_filename='q4.gguf', model_kind='quantized')

# after
load_video_model(repo_id='...', gguf_filename='q4.gguf', model_kind='gguf')
# or let it infer from the filename:
load_video_model(repo_id='...', gguf_filename='q4.gguf')
Defensive patterns

Strategy: validation

Validate before calling

_MODEL_KINDS = {'gguf', 'single_file', 'pipeline'}
def valid_model_kind(model_kind: str | None) -> bool:
    return model_kind is None or model_kind.strip().lower() in _MODEL_KINDS

Type guard

from typing import Literal, Optional
ModelKind = Literal['gguf', 'single_file', 'pipeline']
def as_model_kind(value: str) -> Optional[ModelKind]:
    v = value.strip().lower() if value else None
    return v if v in ('gguf', 'single_file', 'pipeline') else None

Try / catch

try:
    load_video_model(repo_id=r, model_kind=kind)
except ValueError as e:
    if 'Unknown model_kind' in str(e):
        load_video_model(repo_id=r)  # let the filename infer the kind
    else:
        raise

Prevention

When it happens

Trigger: Calling a video load/route with model_kind set to a string not in {'gguf','single_file','pipeline'} — including typos, wrong casing is fine ('GGUF' works due to .lower()) but 'quantized', 'gguff', or 'pipeline ' with inner spaces fail.

Common situations: Hand-written API payloads with a guessed enum value; a frontend sending its internal model-type label instead of the backend enum; stale clients from before the model_kind parameter existed.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/5b17075cedae197f. Report an issue: GitHub.