calesthio/OpenMontage · error · ValueError

Unknown model

Error message

Unknown model: {model_name}

What it means

Raised at the end of _load_model when model_name matches none of the supported vision models (the code shows branches for 'clip' and 'llava' preceding the raise). It is a pure input-validation error: the string was not validated against the allowlist before model loading was attempted. Fix is to pass one of the supported model names.

Solutions

  1. Pass exactly one of the supported names (check the branches in _load_model — e.g. 'clip' or 'llava')
  2. Validate model_name against the allowlist before calling the tool and fail fast with a helpful message listing valid options
  3. Normalize input with model_name.strip().lower() at the boundary if casing is the issue

Example fix

// before
results = tool.run({"model": "GPT-4V"})

// after
ALLOWED = {"clip", "llava"}
model = inputs.get("model", "clip").strip().lower()
if model not in ALLOWED:
    raise ValueError(f"model must be one of {sorted(ALLOWED)}, got {model!r}")
results = tool.run({"model": model})
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED_MODELS = {"clip", "llava"}  # mirror the branches in _load_model
model = inputs.get("model", "clip")
if model not in ALLOWED_MODELS:
    raise ValueError(f"model must be one of {sorted(ALLOWED_MODELS)}")

Type guard

def is_supported_model(name: str) -> bool:
    return name in {"clip", "llava"}

Prevention

When it happens

Trigger: Calling the video-understand describe/analyze tool with model_name values like 'gpt-4v', 'qwen-vl', 'blip', or a typo such as 'CLIP' (case-sensitive) or 'llava1.5'; a config file or CLI flag carrying a model identifier added for a different subsystem.

Common situations: Copied model names from a different tool's docs; case mismatch ('Clip' vs 'clip'); version drift after the tool's supported model list changed; default config value not updated after renaming.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/7982fa79317e00f6. Report an issue: GitHub.

Appendix: source

Thrown at tools/analysis/video_understand.py:399

            return model, processor, device

        if model_name == "blip2":
            model_id = "Salesforce/blip2-opt-2.7b"
            processor = Blip2Processor.from_pretrained(model_id)
            model = Blip2ForConditionalGeneration.from_pretrained(
                model_id, torch_dtype=torch.float16 if device == "cuda" else torch.float32
            ).to(device)
            return model, processor, device

        if model_name == "llava":
            model_id = "llava-hf/llava-1.5-7b-hf"
            processor = AutoProcessor.from_pretrained(model_id)
            model = AutoModelForCausalLM.from_pretrained(
                model_id, torch_dtype=torch.float16 if device == "cuda" else torch.float32
            ).to(device)
            return model, processor, device

        raise ValueError(f"Unknown model: {model_name}")

    def _analyze_describe(
        self, frames: list, model_name: str
    ) -> list[dict[str, Any]]:
        """Generate captions for each frame."""
        import torch

        model, processor, device = self._load_model(model_name)
        results = []

        for i, img in enumerate(frames):
            if model_name == "clip":
                # CLIP is not a captioning model; use zero-shot classification
                # with generic scene descriptions as a caption proxy
                candidate_texts = [
                    "a photo of a person", "a photo of a landscape",
                    "a photo of an object", "a photo of text",
                    "a photo of an animal", "a photo of a building",

View on GitHub (pinned to 95e1c3d0ab)