-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
samgeo.hq_sam not working in docker #223
Comments
Is this related to [https://github.com//issues/201] ? |
No. Not related to #201. I want to run samgeo.hq_sam on the CPU in the same way you can run "normal" samgeo on the CPU. The speed difference between running inference with samgeo on a GPU or a CPU is not too dramatic, esp. when testing (GPU order of 6 faster). The models require a pretty large GPU forcing you to move to cloud resources. I prefer running on CPU. |
Try adding from samgeo.hq_sam import SamGeo
sam = SamGeo(model_type="vit_h", sam_kwargs=None, device='cpu') See if it helps! |
Thanks for the tip, but I tried that, and it doesn't work. The problem is in the sam_hq implementation, which does not check for the device key. To get this solved, you need to go into /opt/conda/lib/python3.11/site-packages/segment_anything_hq/build_sam.py and edit line 160:
which is for the vit_h model, you need to edit the equivalent statements for the other models. This is the quick and dirty solution, it would be better to do this on the basis of the device keyword. (I assume use of the giswqs/segment-geospatial docker image. I (locally) commit the revised container to giswqs/segment-geospatial-cpu) |
Same issue as reported in: #173
However, since the solution provided (install with
pip install git+https://github.com/SysCV/sam-hq.git
) there does not work, I tried running the docker installation instead. But throws same error:RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
suggesting the docker image was not built with the alternative pip install (or, indeed, the alternative install does not work).
Environment Information
The text was updated successfully, but these errors were encountered: