Skip to content

How-ToGPU

How to Run Meta's SAM 3 Locally on Your Own GPU

Meta's SAM 3 can find, cut out and track every object matching a short text phrase in your photos and videos. Using Meta's official GitHub instructions and model card, we show how to get access to the weights, install it on an Nvidia GPU and run your first image and video prompts.

By , Systems & Technical Editor

5 min read

How to Run Meta's SAM 3 Locally on Your Own GPU

Meta's Segment Anything Model 3 (SAM 3) can find and cut out every object that matches a short text description, such as "yellow school bus" or "striped cat", in photos and videos. Earlier Segment Anything models needed a click, box or mask for each object; SAM 3 also accepts text and example boxes, and Meta released the code and weights so you can run it on your own PC. This guide follows Meta's official GitHub instructions and Hugging Face model card. Any performance figures below are Meta's or Ultralytics' own.

What SAM 3 does

Meta describes SAM 3 as a unified model for promptable segmentation in images and videos. It can detect, segment and track objects using:

  • Text prompts – a short noun phrase, and SAM 3 masks every matching object, not just one

  • Exemplar prompts – draw a box around one example and it finds similar objects

  • Visual prompts – positive and negative clicks, boxes and masks, as with SAM 2

The model has 848M parameters and is made up of a detector and a tracker that share a vision encoder. The tracker inherits SAM 2's design, so you still get video tracking and click-to-refine editing. On Meta's new SA-Co benchmark, which covers 270,000 unique concepts, Meta says SAM 3 reaches 75-80% of human performance.

In March 2026 Meta released SAM 3.1 checkpoints with a feature called Object Multiplex, which tracks many objects together rather than one at a time. Meta reports a roughly 7x speed-up when tracking 128 objects on a single H100 GPU compared with the original November 2025 release. If you're starting fresh, use the latest code so you can load either set of checkpoints.

What you need

Meta's README lists three prerequisites:

Requirement

Meta's stated minimum

Python

3.12 or higher

PyTorch

2.7 or higher

GPU

CUDA-compatible GPU with CUDA 12.6 or higher

In practice that means a recent Nvidia graphics card with up-to-date drivers. Meta doesn't publish a minimum VRAM figure. SAM 3 is far smaller than most image generators, but tracking lots of objects in long videos is more demanding, so a 16GB card such as the ASUS RTX 5060 Ti 16GB Dual OC or MSI RTX 5070 Ti 16GB Ventus 3X OC is a comfortable starting point. That's our suggestion, not a Meta requirement. Our guide to how much VRAM you need covers the trade-offs.

SAM 3's README doesn't cover Windows specifically. The SAM 2 README strongly recommends using Windows Subsystem for Linux (WSL) with Ubuntu on Windows, and we'd take the same route for SAM 3, particularly if you want the optional speed-up packages. See how to set up WSL2 for GPU-accelerated local AI first.

Step 1: Request access to the weights

The SAM 3 and SAM 3.1 checkpoints on Hugging Face are gated. Go to the facebook/sam3 model page (and facebook/sam3.1 if you want the newer checkpoints), sign in and request access. You have to agree to share your Hugging Face account information with Meta, and requests are approved manually, so do this first.

Once you've been approved, create an access token in your Hugging Face account settings and log in from the terminal with hf auth login. Our guide to downloading models from Hugging Face explains tokens in more detail. If your system drive is small, you can move the Hugging Face cache to another drive.

Step 2: Create a Python environment and install PyTorch

Meta's instructions use Conda:

conda create -n sam3 python=3.12
conda activate sam3
pip install torch==2.10.0 torchvision --index-url https://download.pytorch.org/whl/cu128

The last line installs a CUDA 12.8 build of PyTorch. To check that PyTorch can see your GPU, run python -c "import torch; print(torch.cuda.is_available())". If it prints False, see how to fix "PyTorch CUDA not available".

Step 3: Install SAM 3

Clone Meta's repository and install it in editable mode:

git clone https://github.com/facebookresearch/sam3.git
cd sam3
pip install -e .

If you want to run Meta's example notebooks, also run pip install -e ".[notebooks]". Meta lists optional extras for faster inference (einops, ninja, a FlashAttention 3 build and the cc_torch package). These are worth trying once the basic install works, but they aren't needed to get started.

Step 4: Segment an image with a text prompt

Meta's basic example loads the image model, sets an image and asks for a concept:

from PIL import Image
from sam3.model_builder import build_sam3_image_model
from sam3.model.sam3_image_processor import Sam3Processor

model = build_sam3_image_model()
processor = Sam3Processor(model)
image = Image.open("photo.jpg")
state = processor.set_image(image)
output = processor.set_text_prompt(state=state, prompt="dog")
masks, boxes, scores = output["masks"], output["boxes"], output["scores"]

You get a mask, bounding box and confidence score for every matching object. Keep prompts short and specific: Meta says SAM 3's design improves discrimination between closely related phrases such as "a player in white" and "a player in red".

Step 5: Track objects in a video

For video, Meta provides a separate predictor. You start a session on an MP4 file or a folder of JPEG frames, then add a text prompt on any frame:

from sam3.model_builder import build_sam3_video_predictor

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

The repository's examples folder includes notebooks for image prompts, video prompts with point refinements, batched inference, SAM 3.1 video tracking and the SAM 3 Agent, which lets you segment with longer, more complex descriptions.

Easier alternatives

If you'd rather not work with Meta's repository directly, there are two simpler code routes:

  • Hugging Face Transformers includes Sam3Model and Sam3Processor classes, so you can load facebook/sam3 with from_pretrained once you have access. The SAM 3.1 repository only hosts checkpoints, with no Transformers integration.

  • Ultralytics supports SAM 3 through pip install -U ultralytics, with a SAM3SemanticPredictor for text and exemplar prompts. Its docs note that you must download sam3.pt yourself after Hugging Face approves your access, because it isn't downloaded automatically.

If you don't want to write any code, the free X-AnyLabeling desktop app and the ComfyUI-SAM3 custom nodes for ComfyUI also support SAM 3.

Troubleshooting

  • Download fails with an authorisation error: your Hugging Face access request hasn't been approved yet, or you aren't logged in with hf auth login.

  • Out of memory on long videos: process shorter clips, track fewer objects at once or close other GPU apps. Our guide to fixing CUDA out of memory errors has more fixes.

  • SAM 3.1 checkpoints won't load: Meta says you need the latest model code, so run git pull in the sam3 folder and reinstall with pip install -e ..

Licence

SAM 3 is released under Meta's own SAM License rather than a standard open-source licence. It grants a royalty-free right to use, copy, modify and redistribute the model, but with conditions, including complying with trade controls and passing the licence on if you share the model. Read it before using SAM 3 in a commercial product.

The bottom line

SAM 3 brings text-prompted segmentation to your own PC: type a short phrase and it masks and tracks every matching object in an image or video. You'll need a recent Nvidia GPU, Python 3.12, PyTorch 2.7 or newer and approved access to Meta's gated checkpoints. On Windows, WSL2 is the smoothest route. Use the latest code so you can load the faster SAM 3.1 checkpoints, and check Meta's licence before using it commercially.

In this article

Sources

  1. 01Meta, SAM 3 GitHub repository and README
  2. 02Meta, SAM 3 model card on Hugging Face
  3. 03Meta, SAM 3.1 release notes
  4. 04Meta, SAM 3.1 checkpoints on Hugging Face
  5. 05Meta, SAM License
  6. 06Meta, SAM 2 GitHub repository and README
  7. 07Hugging Face, Transformers SAM 3 documentation
  8. 08Ultralytics, SAM 3 documentation

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

Best Tools for Running Segment Anything Locally in 2026

Best Picks

Best Tools for Running Segment Anything Locally in 2026

You don't need to write your own code to use Meta's Segment Anything models on your PC. We pick the best free tools for running SAM 2, SAM 3 and SAM 3.1 locally, from Meta's own repository and Ultralytics to the X-AnyLabeling desktop app, ComfyUI nodes and Label Studio.

Hannah Vance5 min

SAM 2 vs SAM 3: Which Segment Anything Model Should You Run Locally?

Versus

SAM 2 vs SAM 3: Which Segment Anything Model Should You Run Locally?

SAM 3 adds text-prompted segmentation of every matching object, but SAM 2.1 is smaller, comes in four sizes and has a simpler licence. We compare prompts, size, Meta's speed and accuracy figures, hardware needs and licences to help you pick the right Segment Anything model.

Callum Reid5 min

How to Use Special K: Frame Limiter, HDR Retrofit and More

How-To

How to Use Special K: Frame Limiter, HDR Retrofit and More

Special K is a free, open-source tool that adds a frame limiter, HDR retrofit, better borderless windows and NVIDIA Reflex to PC games. We explain how to install it, launch games through SKIF, use the frame limiter and HDR calibration, and avoid anti-cheat and compatibility problems, using the official wiki.

Marcus Thorne6 min