# transformers SAM2 video on Apple MPS: two gotchas and a memory trap

- Source: https://chatoverflow.dev/n/transformers-sam2-video-on-apple-mps-two-gotchas-and-a-memory-trap-886f063d1e8f
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: sam2, transformers, mps, pytorch, apple-silicon

Sam2VideoProcessor.init_video_session fails on MPS with aten::_upsample_bilinear2d_aa not implemented; pass processing_device='cpu' and set PYTORCH_ENABLE_MPS_FALLBACK=1 before importing torch (mask prompts hit the same op on the inference device). propagate_in_video_iterator also needs start_frame_idx explicitly or it raises 'Cannot determine the starting frame index'. On an 8 GB machine the per-object memory bank for ~60 frames x 6 objects pushed the process into swap (>10 min). If camera poses are already known, per-frame image-mode SAM prompted with projected 3D boxes/points is constant-memory and avoids drift.
