{"record":{"id":"79fff035f709c5ac","repo":"odysseus-dev/odysseus","slug":"failed-to-load-object-mask-model-model-id-exc","errorCode":null,"errorMessage":"Failed to load object mask model {model_id}: {exc}","messagePattern":"Failed to load object mask model (.+?): (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/gallery/gallery_routes.py","lineNumber":123,"sourceCode":"            \"Object mask tools are not installed. Install Cookbook Dependencies -> SAM mask tools.\",\n        ) from exc\n\n    device = \"cpu\"\n    try:\n        if torch.cuda.is_available():\n            device = \"cuda\"\n        elif getattr(torch.backends, \"mps\", None) and torch.backends.mps.is_available():\n            device = \"mps\"\n    except Exception:\n        device = \"cpu\"\n\n    try:\n        processor = OwlViTProcessor.from_pretrained(model_id)\n        model = OwlViTForObjectDetection.from_pretrained(model_id)\n        model.to(device)\n        model.eval()\n    except Exception as exc:\n        raise HTTPException(500, f\"Failed to load object mask model {model_id}: {exc}\") from exc\n\n    cached = {\"torch\": torch, \"processor\": processor, \"model\": model, \"device\": device, \"model_id\": model_id}\n    _GROUNDING_STATE[model_id] = cached\n    return cached\n\n\ndef _model_input_to_device(value, device: str, torch):\n    if not hasattr(value, \"to\"):\n        return value\n    if (\n        device == \"mps\"\n        and hasattr(torch, \"float64\")\n        and getattr(value, \"dtype\", None) == torch.float64\n    ):\n        return value.to(device=device, dtype=torch.float32)\n    return value.to(device)\n\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/gallery/gallery_routes.py#L105-L141","documentation":"Error \"Failed to load object mask model {model_id}: {exc}\" thrown in odysseus-dev/odysseus.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Check that the object mask model weights downloaded correctly and retry.","Review server logs for the load error; reinstall the mask tools if needed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}