SAM ViT-Base
Will it run on your hardware?
Pick your GPU memory - see which quantizations fit, and the cheapest card for the rest
Need an exact figure for your context length? Use the VRAM calculator.
Run it locally
Copy-paste - running in under a minute
vllm serve facebook/sam-vit-baseNew to this? Start with Ollama · serve to many users with vLLM.
Deep dive
Notes, sources, and the full write-up
SAM - Segment Anything Model
SAM (Segment Anything Model) by Meta AI is a breakthrough in computer vision. Given an image and a prompt (point, box, or automatically generated grid), it produces high-quality segmentation masks for any object. Trained on 11M images and 1.1B masks - the largest segmentation dataset ever.
How it works
SAM has three components:
- VisionEncoder (ViT) - computes image embeddings
- PromptEncoder - embeds points, boxes, or masks
- MaskDecoder - lightweight transformer predicting masks
Usage
from transformers import pipeline
generator = pipeline("mask-generation", device=0)
# Automatically segment everything in an image
outputs = generator("https://example.com/image.jpg")
# Or prompt with a point
outputs = generator("image.jpg", points=[[450, 600]])Three model sizes
| Variant | Params | Speed |
|---|---|---|
| ViT-Base | 93.7M | Fast |
| ViT-Large | 307M | Balanced |
| ViT-Huge | 641M | Most accurate |
When to use
- Photo editing - select and remove objects
- Medical imaging - segment organs/tumors
- Robotics - object grasping
- Creative tools - background removal
- Video editing - object tracking across frames
Frequently asked
Quick answers to common questions
How much VRAM does SAM ViT-Base need?
SAM ViT-Base with 0.09B parameters needs significant VRAM depending on quantization. Use our VRAM calculator for an exact estimate.
Is SAM ViT-Base better than other SAM models?
SAM ViT-Base has 0.09B parameters with 8,192 context - a strong choice for image-segmentation, object-masks, zero-shot-segmentation.
What license is SAM ViT-Base under?
SAM ViT-Base is released under the Apache 2.0 license, making it suitable for most commercial and personal projects.
What hardware runs SAM ViT-Base well?
With 0.09B parameters, SAM ViT-Base requires adequate VRAM. High-end GPUs like the RTX 4090 (24GB), RTX 5090 (32GB), or Mac Studio with unified memory are good options. Check our hardware directory for specific recommendations.
What is the best quantization for SAM ViT-Base?
Q4_K_M is the recommended sweet spot - ~98% of FP16 quality at ~27% of the size. Step up to Q5_K_M or Q8_0 only if you have spare VRAM. Use our VRAM calculator to compare.
What models compete with SAM ViT-Base?
SAM ViT-Base competes with other models in its class. Browse our model directory for comparisons, benchmarks, and community reviews to find the best fit.
Compare & pair with
Similar models and recommended hardware
Related models
Recommended hardware
Nearby options
Similar models and compatible hardware by spec
Comments coming soon
Configure NEXT_PUBLIC_GISCUS_REPO_ID and NEXT_PUBLIC_GISCUS_CATEGORY_ID at giscus.app to enable.