support mps device along with cpu and gpu #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
writing up an attempt to get MPS support faster than CPU, marking as draft because it seems slower (?)
SAM2 supports some MPS acceleration: facebookresearch/sam2#192 Samgeo supports this version of SAM2, so I made a small change to how this project chooses the device by using SamGeo's choose_device function.
Tested this locally on my mac m1 with ds-annotate running locally, pointing to my local samgeo-service
This takes about 8 seconds. I'm not sure but I think this doesn't include computing image embeddings.
this seemed kinda slow so I tried a similar multi point query and hard coded the cpu device
So both device work but cpu seems faster? So anyway this PR might not actually be useful if cpu is actually faster than mps. SAM2 folks say MPS should be faster than cpu so I'm a bit confused. Thought I'd post this up just so folks can see that MPs in theory does work and I might come back to take a look later and see why mps is slower.
Awesome work getting multi-point support implemented!