odysseus-dev/odysseus · error · HTTPException

Failed to load SAM model {model_id}: {exc}

Error message

Failed to load SAM model {model_id}: {exc}

What it means

Error "Failed to load SAM model {model_id}: {exc}" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/gallery/gallery_routes.py:87

            "SAM mask tools are not installed. Install Cookbook Dependencies -> SAM mask tools.",
        ) from exc

    device = "cpu"
    try:
        if torch.cuda.is_available():
            device = "cuda"
        elif getattr(torch.backends, "mps", None) and torch.backends.mps.is_available():
            device = "mps"
    except Exception:
        device = "cpu"

    try:
        processor = SamProcessor.from_pretrained(model_id)
        model = SamModel.from_pretrained(model_id)
        model.to(device)
        model.eval()
    except Exception as exc:
        raise HTTPException(500, f"Failed to load SAM model {model_id}: {exc}") from exc

    cached = {"torch": torch, "processor": processor, "model": model, "device": device, "model_id": model_id}
    _SAM_STATE[model_id] = cached
    return cached


def _load_grounding_backend():
    model_id = os.getenv("ODYSSEUS_GROUNDING_MODEL", "google/owlvit-base-patch32")
    cached = _GROUNDING_STATE.get(model_id)
    if cached:
        return cached
    try:
        import torch
        from transformers import OwlViTForObjectDetection, OwlViTProcessor
    except Exception as exc:
        raise HTTPException(
            501,
            "Object mask tools are not installed. Install Cookbook Dependencies -> SAM mask tools.",

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Check that the SAM model weights downloaded correctly and retry.
  2. Review server logs for the load error; reinstall the SAM mask tools if needed.

When it happens

Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/50d25f9f6e78965b. Report an issue: GitHub.