Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to install SAM 2 on M1 Macbook, but with CUDA error #122

Closed
sangwf opened this issue Aug 2, 2024 · 5 comments
Closed

I want to install SAM 2 on M1 Macbook, but with CUDA error #122

sangwf opened this issue Aug 2, 2024 · 5 comments

Comments

@sangwf
Copy link

sangwf commented Aug 2, 2024

Does that mean I can't do it right now?

Thanks.

@sangwf sangwf changed the title I want to install SAM 2 on M1 Macbook, but with CUDA pro I want to install SAM 2 on M1 Macbook, but with CUDA error Aug 2, 2024
@SimonZeng7108
Copy link

@ronghanghu
Copy link
Contributor

Hi @sangwf, we have recently made the CUDA extension step optional (in #155) as a workaround to this problem.

You can pull the latest code and reinstall via

# run the line below inside the SAM 2 repo
git pull;
pip uninstall -y SAM-2;
rm -f sam2/*.so;
pip install -e ".[demo]"

which allows using SAM 2 without CUDA extension (the results should stay the same in most cases, see INSTALL.md for details).

@albertjo
Copy link

albertjo commented Aug 7, 2024

@ronghanghu I tried following the steps specified in INSTALL.md for the latest code.

# skip the SAM 2 CUDA extension
SAM2_BUILD_CUDA=0 pip install -e ".[demo]"

The installation is successful but when I call build_sam2_video_predictor, I'm getting an AssertionError: Torch not compiled with CUDA enabled error.

I'm following the steps in "video predictor example" notebook. What could I be doing wrong?

@ronghanghu
Copy link
Contributor

@albertjo do you have a GPU in your machine and installed a CUDA version of PyTorch?

Currently the SAM 2 repo doesn't support CPU-only or other devices yet (we might provide this support later). At this moment, if you don't have a GPU on your machine, you may use a few community adaptation in #71 (comment) or #123

@ronghanghu
Copy link
Contributor

Hi @sangwf @albertjo we have recently updated the notebooks to include M1 Chip and MPS examples in #192. Please pull the latest code from this repo and try them out. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants