Help · SAM 3 / 3.1 · troubleshooting
Meta SAM Not Working? Troubleshooting Guide Find your symptom, see the likely cause, and jump straight to the fix. Covers installing, Hugging Face access, checkpoints, GPU memory, speed, empty or wrong masks, video tracking and tools.
Start here
Quick Triage: Where Does It Break?
Problems happen at one of five stages. Fix the earliest failing stage first; later errors often disappear.
- 1Install:does
import sam3work? If not → install fixes. - 2Access:can you download from
facebook/sam3orfacebook/sam3.1? If not → access fixes. - 3Load:does the model build without key or dtype errors? If not → loading fixes.
- 4Run:does it finish without running out of memory, at a usable speed? If not → memory & speed.
- 5Results:are the masks right? If not → result fixes.
Using the browser playground? Skip to tools; stages 1–4 don’t apply.
Symptom finder
Find Your Symptom
Type part of your error message or pick a stage.
- ModuleNotFoundError: No module named 'sam3.sam'Incomplete package installInstall fixes →
- ModuleNotFoundError: No module named 'triton'Windows: no standard triton packageInstall fixes →
- numpy version conflict with OpenCVPinned numpy vs opencv-pythonInstall fixes →
- torch.cuda.is_available() is FalseCPU-only PyTorch or driver mismatchRequirements →
- Python version not supportedSAM 3 needs Python 3.12+Install guide →
- 401 / 403 or “gated repo” errorNot approved or not logged inModel access fix →
- Access request still pendingApproval is manual on Hugging FaceModel access fix →
- Token works for sam3 but not sam3.1facebook/sam3.1 is gated separatelyAccess guide →
- Missing or unexpected keys in state_dictCode too old for the checkpointCheckpoint fix →
- sam3.1_multiplex.pt won’t loadNeeds latest sam3 code or Ultralytics 8.4.148+Checkpoint fix →
- Ultralytics SAM 3.1 gives garbage masksOlder versions loaded parts with random weightsUpgrade guide →
- dtype mismatch: BFloat16 and FloatMixed precision without autocastCheckpoint fix →
- Download corrupted or incompleteInterrupted transferDownload & checksums →
- CUDA out of memoryResolution, frames or objects too largeMemory fix →
- Video tracking is very slowMany objects, CPU, or no compileSpeed fix →
- Runs on CPU, takes minutes per imageNo CUDA GPU detectedRequirements →
- No masks returned (empty result)Prompt wording or thresholdEmpty masks fix →
- Too many objects selectedText finds every matchSelect one object →
- Wrong part selected (shirt, not person)Ambiguous clickCandidates →
- Rough, blocky or haloed edgesLow-res mask enlargedImprove edges →
- Object lost or IDs swap in videoOcclusion, fast motion, driftTracking fix →
- Cutout background is black, not transparentSaved as JPEG or RGBExport guide →
- Ultralytics: error about the clip packageWrong clip package installedTool fixes →
- Transformers can’t load SAM 3.1No official integration yetSAM 3.1 compatibility →
- ComfyUI: SAM 3 nodes or templates missingComfyUI or node pack out of dateComfyUI setup →
- Playground upload fails or is slowBrowser, file size or connectionTool fixes →
26 symptoms
Fix guides
Step-by-Step Fix Guides
The six problems people hit most, each with its own guide.
Stage 1
Install and Import Errors
Most come from an incomplete install, the wrong Python, or Windows-specific packages.
| Symptom | Likely cause | Fix |
|---|---|---|
No module named 'sam3.sam' or 'sam3.model_builder' | Incomplete or old package build | Uninstall, then pip install -e . from a fresh clone of the latest code |
No module named 'triton' | Windows | pip install triton-windows, or use WSL2 |
| numpy conflict after installing OpenCV | Pinned numpy in sam3 | Install sam3 last in a fresh env; keep the numpy it asks for |
Missing einops, pycocotools, decord | Notebook extras not installed | Install them, or pip install -e ".[notebooks]" |
torch.cuda.is_available() is False | CPU-only PyTorch or old driver | Reinstall PyTorch for your CUDA. Requirements |
clean reinstall
# start clean: fresh environment + editable install from a fresh clone
conda create -n sam3 python=3.12 -y && conda activate sam3
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128 # match your CUDA
git clone https://github.com/facebookresearch/sam3.git && cd sam3
pip install -e . # editable install from the clone
pip install einops pycocotools # extras the notebooks use
pip install triton-windows # Windows only; Linux uses the standard tritonFull walkthrough: install SAM 3.
Stage 2
Hugging Face Access Errors
SAM 3 and SAM 3.1 checkpoints are gated. Access is per repository.
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Not logged in in this environment | hf auth login, then hf auth whoami |
| 403 / “gated repo” / “access restricted” | Not approved yet, or token can’t read gated repos | Check the model page; give a fine-grained token gated-repo read access |
Works for facebook/sam3, fails for sam3.1 | Separate gate | Request access to facebook/sam3.1 too |
| Works on laptop, fails on server or Docker | Token not present there | Set HF_TOKEN or log in on that machine |
Fix guide: model access · Setup: Hugging Face access
Stage 3
Checkpoint Loading Errors
The code and the checkpoint must match. SAM 3.1 especially needs up-to-date code.
| Symptom | Likely cause | Fix |
|---|---|---|
Missing / unexpected keys in state_dict | Old code, or SAM 3.1 file with a SAM 3 builder | git pull + reinstall; use the SAM 3.1 builder for 3.1 |
sam3.1_multiplex.pt fails with every builder | Reported on some versions of the public code | Update to the latest commit; check open sam3 GitHub issues for your error |
| Ultralytics + SAM 3.1 gives nonsense masks | Versions before 8.4.148 mis-mapped keys | pip install -U "ultralytics>=8.4.148" |
mat1 and mat2 must have the same dtype | bfloat16 weights, float32 input | Run inside torch.autocast("cuda", dtype=torch.bfloat16) |
| Unpickling error / unexpected EOF | Corrupt or partial download | Delete and download again; check SHA-256 |
Fix guide: checkpoint loading · Checksums: download · upgrade to SAM 3.1
Stage 4
Out of Memory and Slow Runs
Memory and time grow with resolution, number of frames and number of objects.
- CUDA out of memory (images): resize very large photos, use half precision, close other GPU apps.
- CUDA out of memory (video): process shorter chunks, lower frame resolution, fewer objects, offload frames to CPU.
- Slow video with many objects: SAM 3.1’s Object Multiplex tracks up to 16 objects per pass; SAM 3.1.
- Minutes per image: it’s probably running on CPU; check
torch.cuda.is_available(). - Fix guides: out of memory · slow tracking
Stage 5
Wrong, Empty or Messy Results
The model runs, but the masks aren’t what you wanted.
- No masks: use a simple noun (“car”, not a sentence), lower the score threshold, or click the object. Empty masks
- Too many or the wrong object: text finds every match; pick one with a click or a rule. Select specific objects
- Rough edges or halos: improve mask edges
- Video object lost or IDs swap: add a correction click on the bad frame. Tracking loses objects
- Prompt ideas that work: prompt examples · Known limits: limitations
Tools
Playground, Ultralytics, Transformers and ComfyUI
| Tool | Symptom | Fix |
|---|---|---|
| Playground | Upload fails, stalls or the page is blank | Desktop Chrome or Edge, a shorter or smaller file, disable blockers, try again later |
| Ultralytics | Error mentioning the clip package | pip uninstall clip -y then pip install git+https://github.com/ultralytics/CLIP.git |
| Ultralytics | sam3.pt not found | Weights aren’t auto-downloaded; get them from Hugging Face and pass the path |
| Ultralytics | SAM 3.1 video doesn’t work | Not supported yet; use sam3.pt for video |
| Transformers | Can’t load facebook/sam3.1 | No official integration yet; use Meta’s sam3 code. Compatibility |
| ComfyUI | SAM 3 templates or nodes missing | Update ComfyUI; put the model in the folder the guide shows. ComfyUI setup |
| Hosted API | Errors or unexpected output | Check the provider’s model name, limits and status page. API guide |
Diagnose
Run the Environment Check Script
One script checks the usual suspects in order and tells you which stage fails.
- Checks: Python version, PyTorch and CUDA, GPU memory, key imports, Hugging Face login.
- Checksums: pass checkpoint paths to verify official
sam3.ptandsam3.1_multiplex.ptfiles. - Safe: it only reads; nothing is installed or changed.
- Share the output when asking for help.
Code
check_sam.py
check_sam.py · run: python check_sam.py checkpoints/sam3.pt
# check_sam.py: print what usually goes wrong, in order
import hashlib, importlib, platform, sys
from pathlib import Path
def ok(msg): print("✓", msg)
def bad(msg): print("✗", msg)
v = sys.version_info
(ok if v >= (3, 12) else bad)(f"python {platform.python_version()} (SAM 3 needs 3.12+)")
try:
import torch
cuda = torch.cuda.is_available()
(ok if cuda else bad)(f"torch {torch.__version__} · cuda {cuda}")
if cuda:
p = torch.cuda.get_device_properties(0)
ok(f"gpu: {p.name} · {p.total_memory / 1e9:.1f} GB")
except ImportError:
bad("torch not installed")
for mod in ["sam3", "triton", "einops", "pycocotools"]:
try:
importlib.import_module(mod)
ok(f"import {mod}")
except Exception as e:
bad(f"import {mod}: {type(e).__name__}: {e}")
try:
from huggingface_hub import whoami
ok(f"hf login: {whoami()['name']}")
except Exception as e:
bad(f"hf login: {type(e).__name__} (run: hf auth login)")
EXPECTED = { # official files
"sam3.pt": "9999e2341ceef5e136daa386eecb55cb414446a00ac2b55eb2dfd2f7c3cf8c9e",
"sam3.1_multiplex.pt": "0567debeec80ba4ac6369540c6c248025283cb3ff2b92827509e57e2b3541cb6",
}
for path in sys.argv[1:]: # python check_sam.py checkpoints/sam3.pt
f = Path(path)
if not f.exists():
bad(f"{f}: not found"); continue
h = hashlib.sha256()
with f.open("rb") as fh:
for chunk in iter(lambda: fh.read(1 << 20), b""):
h.update(chunk)
want = EXPECTED.get(f.name)
if want is None:
ok(f"{f.name}: sha256 {h.hexdigest()[:16]}… (no reference)")
else:
(ok if h.hexdigest() == want else bad)(f"{f.name}: sha256 {'matches' if h.hexdigest() == want else 'MISMATCH, download again'}")Still stuck?
How to Get Help Faster
Include this
- The output of
check_sam.py. - The full error, not just the last line.
- The model (SAM 3 or 3.1), checkpoint and code version (
git log -1). - A minimal example: one image or a short clip, one prompt.
Ask in the right place
- Meta’s code:
facebookresearch/sam3GitHub issues; search first, as many errors are already answered there. - Ultralytics, ComfyUI, Transformers or an API: that project’s own support.
- General questions: our FAQ.
Questions
Troubleshooting FAQ
Why does SAM 3 say access is restricted or return a 401/403 error?
The checkpoints on Hugging Face are gated. Your request may still be pending, you may not be logged in, or your token can’t read gated repos. SAM 3.1 (facebook/sam3.1) needs its own access request.
Why do I get “No module named sam3.sam” or “triton”?
The package was installed incompletely, or you’re on Windows where the standard triton package isn’t available. Install from a fresh clone with pip install -e ., and on Windows add triton-windows.
Why does SAM 3 run out of GPU memory?
The model is large and video sessions keep memory for every frame and object. Use a shorter clip or lower resolution, fewer objects, half precision, or a GPU with more memory.
Why does SAM 3 return no masks?
Usually the prompt doesn’t match how SAM 3 names things, the score threshold is too high, or the object is very small. Try a simpler noun, lower the threshold, or click the object instead.
Why won’t the SAM 3.1 checkpoint load?
SAM 3.1 needs the latest sam3 code (or Ultralytics 8.4.148+ for images). Older code reports missing or unexpected keys. Also check the file’s checksum.
Where do I report a bug?
For Meta’s code, the facebookresearch/sam3 GitHub issues; for Ultralytics, ComfyUI or other tools, their own trackers. Include versions, the full error and a minimal example.