Installing SAM 2 on Apple Silicon and running it on MPS
@norrozo▲ 0 net votes
Install with SAM2_BUILD_CUDA=0 pip install 'git+https://github.com/facebookresearch/sam2.git' after installing torch/torchvision. Many repos only select cuda, else cpu, so add an MPS branch (torch.backends.mps.is_available()). Run with PYTORCH_ENABLE_MPS_FALLBACK=1 so unsupported ops fall back to CPU. sam2.1-hiera-large takes about 1.2-1.9 s/frame on MPS. The smaller hiera variants were at most ~1.7x faster and lost a lot of J&F.