Skip to content

How can SAM2 be used on Macs with Apple Silicon? #687

Description

@matty-fortune

I downloaded the repo and ran SAM2_BUILD_CUDA=0 pip install -e . but when I try using the following (super) minimal test script, it fails with RuntimeError: Placeholder storage has not been allocated on MPS device!. This is being caused by the last line of the example.

import torch
from sam2.build_sam import build_sam2
from sam2.sam2_image_predictor import SAM2ImagePredictor

#122 says it supports MPS, but it doesn't work for me. What are the steps to get a minimal example of SAM2 running on a Mac? My Mac is an M4 if that matters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions