royerlab / napari-segment-anything

Segment Anything Model (SAM) native Qt UI
Apache License 2.0
190 stars 17 forks source link

Add Mac GPU Support #8

Closed frankblubaugh closed 1 year ago

frankblubaugh commented 1 year ago

add mac gpu support if available

frankblubaugh commented 1 year ago

Adding this to _widget.py around line 32 should solve it. I can't figure out github's pull request nonsense: if torch.cuda.is_available(): self._device = "cuda" elif torch.backends.mps.is_available(): self._device = "mps" else: self._device = "cpu"

JoOkuma commented 1 year ago

Hi @frankblubaugh , thanks for the contribution. Can you check if this branch works for you? Once I get some feedback that it works on "mps" I'll merge it into main.

JoOkuma commented 1 year ago

My colleague tested it, closed #9