Cannot run on Apple Silicon (M4) due to Triton

#11
by Metaphorz - opened

Working with an AI coder and have YOLO and Google's segmenter working but after downloading sam3.pt, I am reading that triton is tied to CUDA so I cannot have this work with MPS. Does anyone have a workaround? Here is Claude Code's SAM3 report:

SAM 3 Findings:
After downloading the checkpoint and attempting
setup, I discovered that SAM 3 cannot run on Apple
Silicon because:

  • Hard dependency on triton library (CUDA-only, no
    MPS support)
  • The dependency chain requires triton for
    Euclidean Distance Transform calculations
  • PyTorch 2.9+ also expects triton to be available
  • Requires NVIDIA GPU with CUDA to function
AI at Meta org

Have you tried the transformers implementation on main branch? (pip install git+https://github.com/huggingface/transformers)
I haven't tested the implementation on MPS, but it shouldn't have the triton dependency issue

I just tested it works if we install from github pip install git+https://github.com/huggingface/transformers torchvision on apple silicon

@yonigozlan , @AbacusGauge : thanks much. Indeed transformers from HF was the solution!. We can close this ticket. I think I need to educate myself more on SAM 3 especially, threshold and mask settings.

@abacus . Your demo is excellent. We (claude code and me) borrowed, with attribution to Abacus,
this code. We have an emerging tool that covers 3 segmentation models: Yolo, Gemini, and Meta
SAM3. Adding Grounding Dino right now as a 4th. If there is interest, I can push to github but I need
to make sure to leave the Meta pt out of it so that users will need to go through the
Meta agreement.

Thanks @Metaphorz

you are attributing to the wrong person. I am https://huggingface.co/AbacusGauge (https://github.com/amritsingh183)

Sign up or log in to comment