Skip to content

load model onto cpu if cuda isn't available#25

Merged
lkeab merged 1 commit into
SysCV:mainfrom
eddogola:dynamic_device_load
Aug 13, 2023
Merged

load model onto cpu if cuda isn't available#25
lkeab merged 1 commit into
SysCV:mainfrom
eddogola:dynamic_device_load

Conversation

@eddogola

Copy link
Copy Markdown
Contributor

Load the model onto cpu if cuda device isn't available

As it stands, the user has to go down to the code to change where the weights/ckpt is loaded into. This fix loads the ckpt into a device dynamically, based on which device is present.

@eddogola

Copy link
Copy Markdown
Contributor Author

@lkeab

@giswqs

giswqs commented Aug 13, 2023

Copy link
Copy Markdown
Contributor

I was looking for cpu support as well. Please consider merging this one so that hq-sam behaves the same as SAM. This will make life easier for downstream packages.

@lkeab

lkeab commented Aug 13, 2023

Copy link
Copy Markdown
Collaborator

Thanks for the suggestion. We follow the code design of SAM in this part. We merged the request.

@rtyley

rtyley commented Oct 22, 2023

Copy link
Copy Markdown

Many thanks @lkeab & @eddogola for this. The most recent pip release of segment-anything-hq was on 11th August 2023, but this PR was merged 2 days later on 13th August - could you do another pip release that includes this fix?

Note that thanks to pip's ability to install from VCS, as a workaround you can specify the package in a requirements.txt file as a direct link to the latest commit of this repo:

segment-anything-hq @ git+https://github.com/SysCV/sam-hq@5fd027ec559806dec9f876b56938175a63dfc625

...however, this will currently fail, until the issue mentioned in #83 is fixed...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants