odysseus-dev/odysseus · error · HTTPException
SAM mask tools are not installed. Install Cookbook Dependenc
Error message
SAM mask tools are not installed. Install Cookbook Dependencies -> SAM mask tools.
What it means
Error "SAM mask tools are not installed. Install Cookbook Dependencies -> SAM mask tools." thrown in odysseus-dev/odysseus.
Source
Thrown at routes/gallery/gallery_routes.py:67
raise HTTPException(400, "Invalid image") from exc
def _pil_image_to_b64(img, *, fmt: str = "PNG") -> str:
buf = io.BytesIO()
img.save(buf, format=fmt)
return base64.b64encode(buf.getvalue()).decode("ascii")
def _load_sam_backend():
model_id = os.getenv("ODYSSEUS_SAM_MODEL", "facebook/sam-vit-base")
cached = _SAM_STATE.get(model_id)
if cached:
return cached
try:
import torch
from transformers import SamModel, SamProcessor
except Exception as exc:
raise HTTPException(
501,
"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()View on GitHub (pinned to f9235ebbf1)
Solutions
- Install the SAM mask tools via Cookbook Dependencies → SAM mask tools.
- Restart the server after installing the dependencies.
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/f972be2fd37815a1.
Report an issue: GitHub.