Meta SAM 3 Playground

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.

find the failing stage
Animation of finding where SAM failsFive stages in a row: install, access, load, run and results. A green check passes through install and access, then a red cross appears at the load stage, and an arrow points down to the matching fix: update the code and check the checksum. where does it break? installpip / importaccessHugging FaceloadcheckpointrunGPU / speedresultsmasks “missing keys in state_dict” → update code · verify checksum find the first stage that fails; fix that one first
Illustration: locate the first stage that fails.

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.

  1. 1Install:does import sam3 work? If not → install fixes.
  2. 2Access:can you download from facebook/sam3 or facebook/sam3.1? If not → access fixes.
  3. 3Load:does the model build without key or dtype errors? If not → loading fixes.
  4. 4Run:does it finish without running out of memory, at a usable speed? If not → memory & speed.
  5. 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.

26 symptoms

Stage 1

Install and Import Errors

Most come from an incomplete install, the wrong Python, or Windows-specific packages.

SymptomLikely causeFix
No module named 'sam3.sam' or 'sam3.model_builder'Incomplete or old package buildUninstall, then pip install -e . from a fresh clone of the latest code
No module named 'triton'Windowspip install triton-windows, or use WSL2
numpy conflict after installing OpenCVPinned numpy in sam3Install sam3 last in a fresh env; keep the numpy it asks for
Missing einops, pycocotools, decordNotebook extras not installedInstall them, or pip install -e ".[notebooks]"
torch.cuda.is_available() is FalseCPU-only PyTorch or old driverReinstall 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 triton

Full walkthrough: install SAM 3.

Stage 2

Hugging Face Access Errors

SAM 3 and SAM 3.1 checkpoints are gated. Access is per repository.

SymptomLikely causeFix
401 UnauthorizedNot logged in in this environmenthf auth login, then hf auth whoami
403 / “gated repo” / “access restricted”Not approved yet, or token can’t read gated reposCheck the model page; give a fine-grained token gated-repo read access
Works for facebook/sam3, fails for sam3.1Separate gateRequest access to facebook/sam3.1 too
Works on laptop, fails on server or DockerToken not present thereSet 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.

SymptomLikely causeFix
Missing / unexpected keys in state_dictOld code, or SAM 3.1 file with a SAM 3 buildergit pull + reinstall; use the SAM 3.1 builder for 3.1
sam3.1_multiplex.pt fails with every builderReported on some versions of the public codeUpdate to the latest commit; check open sam3 GitHub issues for your error
Ultralytics + SAM 3.1 gives nonsense masksVersions before 8.4.148 mis-mapped keyspip install -U "ultralytics>=8.4.148"
mat1 and mat2 must have the same dtypebfloat16 weights, float32 inputRun inside torch.autocast("cuda", dtype=torch.bfloat16)
Unpickling error / unexpected EOFCorrupt or partial downloadDelete 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.

GPU memory
Animation of GPU memory filling during videoA GPU memory bar fills as a long video with many objects is processed, until it hits the limit and shows an out-of-memory error. Then shorter clips, lower resolution and fewer objects keep the bar below the limit. GPU memory limit long 4K clip · 40 objects · fp32 → CUDA out of memory shorter clip + 720p frames + half precision + fewer objects → fits memory grows with: resolution × frames × objects fix: /troubleshooting/cuda-out-of-memory/
Illustration of memory use and fixes.
  • 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.

empty result
Animation of fixing an empty resultA text prompt “automobile with a dented door” finds nothing. Changing the prompt to the simple noun “car” finds both cars. Lowering the score threshold also recovers a small, distant car. “automobile with a dented door”0 masks “car” 2 masks · simple noun phrase “car” · threshold 0.5 → 0.3 3 masks · small car recovered
Illustration of fixing an empty result.

Tools

Playground, Ultralytics, Transformers and ComfyUI

ToolSymptomFix
PlaygroundUpload fails, stalls or the page is blankDesktop Chrome or Edge, a shorter or smaller file, disable blockers, try again later
UltralyticsError mentioning the clip packagepip uninstall clip -y then pip install git+https://github.com/ultralytics/CLIP.git
Ultralyticssam3.pt not foundWeights aren’t auto-downloaded; get them from Hugging Face and pass the path
UltralyticsSAM 3.1 video doesn’t workNot supported yet; use sam3.pt for video
TransformersCan’t load facebook/sam3.1No official integration yet; use Meta’s sam3 code. Compatibility
ComfyUISAM 3 templates or nodes missingUpdate ComfyUI; put the model in the folder the guide shows. ComfyUI setup
Hosted APIErrors or unexpected outputCheck 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.

check script
Animation of the environment check scriptA terminal runs the check script. Lines appear one by one: Python version OK, PyTorch and CUDA OK, GPU memory shown, sam3 import OK, Hugging Face login OK, and finally the checkpoint checksum does not match, pointing to the problem. $ python check_sam.py ✓ python 3.12.7✓ torch 2.10 · cuda True✓ gpu: 24.0 GB✓ import sam3✓ hf login: you✗ sam3.pt sha256 mismatch
Illustration of the script output.
  • Checks: Python version, PyTorch and CUDA, GPU memory, key imports, Hugging Face login.
  • Checksums: pass checkpoint paths to verify official sam3.pt and sam3.1_multiplex.pt files.
  • 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/sam3 GitHub 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.

Keep reading