Meta SAM 3 Playground

Guide · SAM 3 → SAM 3.1 · Object Multiplex

How to Upgrade to Meta SAM 3.1 Update the code, swap in the verified sam3.1_multiplex.pt checkpoint, switch to compatible video code, and check speed, memory and masks on your own clips before you roll it out.

sam3 → sam3.1
Animation of swapping SAM 3 for SAM 3.1The sam3.pt checkpoint slides out and sam3.1_multiplex.pt slides in. A speedometer needle then moves from 16 to 32 frames per second, Meta’s reported H100 figure at medium object counts. checkpoint slot sam3.pt sam3.1_multiplex.pt 16 FPS32 FPSH100 · medium object counts (Meta)
Illustration: swap the checkpoint, double the throughput (Meta’s H100 figure).

Before you start

Should You Upgrade?

SAM 3.1 is about multi-object video speed. The more objects you track, the bigger the win.

per-object vs multiplex
Animation comparing per-object and multiplexed trackingTop, SAM 3: sixteen objects go through the tracker one at a time, so the bar fills slowly. Bottom, SAM 3.1: the same sixteen objects go through together in one shared pass, so the bar fills quickly. SAM 3 · one object per passSAM 3.1 · up to 16 per pass illustrative · shared memory means more objects cost far less extra time
Illustration of Object Multiplex.
  • Upgrade now: video with many objects (sports, traffic, crowds, wildlife); Meta reports 16 → 32 FPS on an H100 at medium counts and ~7× at 128 objects.
  • Accuracy: video object segmentation improved on 6 of 7 benchmarks (e.g. SA-V J&F 84.4 → 85.1).
  • Can wait: image-only pipelines; the release focuses on video tracking.
  • Check your stack: Transformers has no official SAM 3.1 integration; Ultralytics supports images only so far.
  • Details: SAM 3 vs SAM 3.1 · SAM 3.1 overview

Step 1

Prepare a Safe Upgrade

Record a baseline and keep a way back before changing anything.

upgrade path
Animated upgrade pathSix upgrade steps light up in order: request access to facebook/sam3.1, git pull the latest code, reinstall, download and verify the checkpoint, switch to the SAM 3.1 builder, and validate against the SAM 3 baseline. accesssam3.1 repogit pulllatest codereinstallpip -e .checkpointverify SHAbuilder3.1 predictorvalidatevs baseline keep SAM 3 untouched in another env until validation passes
Illustration of the six upgrade steps.
  1. 1Record a baselineTime and save SAM 3 results on a few of your own clips.
  2. 2Request SAM 3.1 accessfacebook/sam3.1 is gated separately from facebook/sam3.
  3. 3Update the codegit pull in the sam3 folder, then pip install -e .
  4. 4Download and verify the checkpointhf download facebook/sam3.1; check size and SHA-256 of sam3.1_multiplex.pt.
  5. 5Switch the builderUse the SAM 3.1 video predictor; prompts and session requests stay the same.
  6. 6Validate, then roll outCompare speed, VRAM and masks against the baseline; keep SAM 3 for rollback.

terminal

# 1. Keep today's SAM 3 setup untouched
cd sam3 && git rev-parse HEAD > ../sam3_known_good_commit.txt && cd ..

# 2. Clone a fresh env for 3.1 (rollback = just switch env)
conda create -n sam31 --clone sam3
conda activate sam31

Also request access to facebook/sam3.1 now; approval is separate from facebook/sam3. Hugging Face access guide

Step 2 · Compatible code

Update the sam3 Code

SAM 3.1 checkpoints need the latest model code. Pull and reinstall inside the new environment.

Code

inside the sam31 environment

cd sam3
git pull                          # SAM 3.1 needs the latest model code
pip install -e .                  # reinstall so the new code is used
git log -1 --format="%h %cd"       # note the commit you validated

Requirements are unchanged: Python 3.12+, PyTorch 2.7+, CUDA 12.6+. System requirements

Step 3 · Checkpoints

Download and Verify the SAM 3.1 Checkpoint

One file does the job: sam3.1_multiplex.pt, about 3.5 GB, from Meta’s gated repo.

Checkpoints

terminal

hf auth whoami                    # approved account?
hf download facebook/sam3.1 --local-dir checkpoints/sam3.1

ls -l checkpoints/sam3.1/sam3.1_multiplex.pt            # 3502755717 bytes
sha256sum checkpoints/sam3.1/sam3.1_multiplex.pt
# 0567debeec80ba4ac6369540c6c248025283cb3ff2b92827509e57e2b3541cb6
FileWhereSizeUse with
sam3.1_multiplex.ptfacebook/sam3.1 (official)3,502,755,717 bytes (~3.5 GB)sam3 repo, Ultralytics images
sam3.1_multiplex_fp16.safetensorsComfy-Org repack~1.6 GiBComfyUI native nodes
sam3.ptfacebook/sam33.45 GBKeep for rollback and Ultralytics video

Repacks and quantized community files are unofficial; the SAM License still applies. Download guide

Step 4 · Compatible code

Switch Your Code to SAM 3.1

Session requests and prompts stay the same. Only the builder changes.

Code

before · SAM 3

from sam3.model_builder import build_sam3_video_predictor

predictor = build_sam3_video_predictor()
sid = predictor.handle_request(dict(
    type="start_session", resource_path="clip.mp4"))["session_id"]
predictor.handle_request(dict(
    type="add_prompt", session_id=sid,
    frame_index=0, text="player"))

after · SAM 3.1

from sam3.model_builder import build_sam3_predictor

predictor = build_sam3_predictor(version="sam3.1")   # new
sid = predictor.handle_request(dict(
    type="start_session", resource_path="clip.mp4"))["session_id"]
predictor.handle_request(dict(
    type="add_prompt", session_id=sid,
    frame_index=0, text="player"))         # unchanged

options: tuned predictor or local checkpoint

# tuned SAM 3.1 video predictor
from sam3.model_builder import build_sam3_multiplex_video_predictor
predictor = build_sam3_multiplex_video_predictor(
    compile=True,          # torch.compile; first calls are slower
    max_num_objects=16,
)

# explicit local checkpoint, no Hugging Face lookup
from sam3.model_builder import build_sam3_multiplex_video_model
model = build_sam3_multiplex_video_model(
    checkpoint_path="checkpoints/sam3.1/sam3.1_multiplex.pt",
    load_from_HF=False, device="cuda")

Ultralytics: images only

pip install -U "ultralytics>=8.4.148"    # fixes SAM 3.1 checkpoint-key loading

from ultralytics.models.sam import SAM3SemanticPredictor
p = SAM3SemanticPredictor(overrides=dict(model="sam3.1_multiplex.pt", task="segment", mode="predict"))
p.set_image("street.jpg")
results = p(text=["bus"])
# video: keep sam3.pt with SAM3VideoPredictor for now

Builder names follow the current sam3 code; confirm them in Meta’s examples/sam3.1_video_predictor_example.ipynb and RELEASE_SAM3p1.md for your commit. Full video walkthrough: video segmentation with Python. ComfyUI: setup guide.

Compatibility

Where SAM 3.1 Works Today

Check every tool in your pipeline before switching production.

compatibility
Animated SAM 3.1 compatibility matrixRows appear in turn: the official sam3 repo supports SAM 3.1 for video with Object Multiplex and for images; Ultralytics supports SAM 3.1 for images from version 8.4.148 but not multiplex video yet; Transformers has no official SAM 3.1 integration; ComfyUI has native SAM 3.1 nodes. sam3 repo · video✓ multiplexsam3 repo · image✓ (no headline change)Ultralytics · image✓ 8.4.148+Ultralytics · video✗ not yetTransformers✗ no official portComfyUI✓ native nodes
Illustration of current SAM 3.1 support.
ToolImagesMultiplex video
sam3 repo (latest)YesYes
UltralyticsYes (8.4.148+)Not yet
TransformersNo officialNo official
ComfyUINativeNative
Hosted APIsProvider-specificProvider-specific

Hosted options: API guide

Step 5 · Validation

Validate SAM 3.1 Against Your Baseline

Run both models on the same clips and prompt, then compare mask agreement, speed and memory. Use 3–5 clips that look like production.

Validation
validation report
Animated validation dashboardA validation report fills in four bars comparing SAM 3.1 with the SAM 3 baseline on the same clips: mask agreement measured as IoU, throughput speed-up, peak GPU memory, and average objects per frame. A pass badge appears when all checks meet their targets. Numbers are illustrative. mask agreement (IoU)≥ 0.90 targetthroughput ×2.0× vs SAM 3peak VRAM−45%objects / framesimilar count ✓ PASS illustrative numbers · run on your clips
Illustrative validation dashboard.
  • Mask agreement: best-match IoU between SAM 3 and SAM 3.1 masks per frame; ≥ 0.90 means results are essentially the same.
  • Speed: frames per second for the whole propagation, same clip and GPU.
  • Memory: peak GPU memory during the run.
  • Object count: average objects per frame; a big change needs a look.
  • Eyes on it: render both outputs on a few clips and compare crossings and occlusions. Targets are suggestions; set your own.

validate_upgrade.py

import json, sys, time
import numpy as np
import torch
from sam3.model_builder import build_sam3_video_predictor, build_sam3_predictor

CLIP, PROMPT = sys.argv[1], sys.argv[2]          # python validate_upgrade.py clip.mp4 player

def to_np(x):
    return x.detach().cpu().numpy() if hasattr(x, "detach") else np.asarray(x)

def run(predictor):
    torch.cuda.reset_peak_memory_stats()
    sid = predictor.handle_request(dict(type="start_session", resource_path=CLIP))["session_id"]
    predictor.handle_request(dict(type="add_prompt", session_id=sid, frame_index=0, text=PROMPT))
    frames, t0 = {}, time.time()
    for r in predictor.handle_stream_request(dict(type="propagate_in_video", session_id=sid)):
        o = r["outputs"]
        frames[r["frame_index"]] = [np.squeeze(m).astype(bool) for m in to_np(o["out_binary_masks"])]
    secs = time.time() - t0
    predictor.handle_request(dict(type="close_session", session_id=sid))
    return frames, len(frames) / secs, torch.cuda.max_memory_allocated() / 1024**3

def agreement(a, b):
    # best-match IoU of each SAM 3 mask against the SAM 3.1 masks
    if not a and not b: return 1.0
    if not a or not b: return 0.0
    return float(np.mean([max((m & n).sum() / max((m | n).sum(), 1) for n in b) for m in a]))

old, fps_old, mem_old = run(build_sam3_video_predictor())
new, fps_new, mem_new = run(build_sam3_predictor(version="sam3.1"))
iou = float(np.mean([agreement(old[f], new.get(f, [])) for f in old]))
objs = (np.mean([len(v) for v in old.values()]), np.mean([len(v) for v in new.values()]))

report = dict(mask_iou=round(iou, 3), speedup=round(fps_new / fps_old, 2),
              fps=[round(fps_old, 1), round(fps_new, 1)], peak_vram_gb=[round(mem_old, 1), round(mem_new, 1)],
              avg_objects=[round(objs[0], 1), round(objs[1], 1)])
report["pass"] = report["mask_iou"] >= 0.90 and report["speedup"] >= 1.0
print(json.dumps(report, indent=2))

example output (illustrative)

$ python validate_upgrade.py match.mp4 player
{
  "mask_iou": 0.934,
  "speedup": 1.87,
  "fps": [11.2, 20.9],
  "peak_vram_gb": [21.4, 13.8],
  "avg_objects": [9.6, 9.8],
  "pass": true
}

The script uses the current video API output keys (out_binary_masks); if your version differs, print(r["outputs"].keys()) once and adjust. Run on a GPU with room for one model at a time; it closes each session before the next.

Step 6

Roll Out and Keep a Way Back

Roll out

  • Pin the validated sam3 commit and checkpoint hash.
  • Start with one workload or a share of traffic.
  • Watch speed, memory and error rates for a week.
  • Update docs and dashboards to say “SAM 3.1”.

Roll back

  • conda activate sam3: the untouched environment.
  • Or git checkout $(cat sam3_known_good_commit.txt) and reinstall.
  • Use the SAM 3 builder and sam3.pt again.
  • Keep both checkpoints until you’re sure.

Troubleshooting

Upgrade Problems and Fixes

SymptomLikely causeFix
ImportError for the 3.1 builderOld sam3 codegit pull and pip install -e . in the active env
Unexpected / missing keys on load3.1 weights with SAM 3 builder (or vice versa)Match builder to checkpoint. Checkpoint loading
401 / 403 for facebook/sam3.13.1 access not approvedRequest sam3.1 separately. Model access
Ultralytics masks look randomOld Ultralytics versionUpgrade to 8.4.148 or newer
First run slower than SAM 3torch.compile warm-upTime later runs, or set compile=False
Little or no speed-upOnly 1–2 objects per clipExpected: gains grow with object count
SHA-256 mismatchPartial or unofficial fileDelete and re-download from facebook/sam3.1

Questions

SAM 3.1 Upgrade FAQ

Is SAM 3.1 a drop-in replacement for SAM 3?

For video, mostly: the session requests and prompts are the same, but you need the latest sam3 code, the new facebook/sam3.1 checkpoint, and the SAM 3.1 video predictor builder.

Do I need new code to use SAM 3.1?

Yes. Meta says SAM 3.1 checkpoints need the latest model code: run git pull in your sam3 checkout and reinstall with pip install -e .

Will SAM 3.1 make image segmentation better?

Meta’s release focuses on video. The headline change is Object Multiplex for faster multi-object tracking, so image-only pipelines can stay on SAM 3 unless your own tests show a gain.

How much faster is SAM 3.1?

Meta reports throughput doubling from 16 to 32 FPS on one H100 at medium object counts, and about 7× faster than SAM 3 at 128 objects. Gains are smallest with only one or two objects.

Does SAM 3.1 work in Transformers or Ultralytics?

The facebook/sam3.1 repo has checkpoints only, with no Transformers integration. Ultralytics loads sam3.1_multiplex.pt in its image predictors but not yet for Object Multiplex video tracking.

How do I verify the SAM 3.1 checkpoint?

sam3.1_multiplex.pt should be 3,502,755,717 bytes with SHA-256 0567debeec80ba4ac6369540c6c248025283cb3ff2b92827509e57e2b3541cb6.

How do I roll back to SAM 3?

Keep a separate environment or git commit for SAM 3, and keep sam3.pt. Switching back means activating that environment and using the SAM 3 builder again.

Keep reading