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

trouble running Geo-SAM Image Encoder! #34

Open
MohammadMr opened this issue Feb 26, 2024 · 3 comments
Open

trouble running Geo-SAM Image Encoder! #34

MohammadMr opened this issue Feb 26, 2024 · 3 comments

Comments

@MohammadMr
Copy link

i'm using .tif file as input and my laptop doesn't have cuda installed on it.
the 'Use GPU if CUDA is available' box is unchecked
I'm getting the fallowing 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.

what can i do? should i install CUDA?

@Fanchengyan
Copy link
Collaborator

Hi @MohammadMr

Could you please post the original error log? Based on your current information, I am unable to pinpoint the issue.

@MohammadMr
Copy link
Author

sure, here it is:

Traceback (most recent call last):
File "C:\Users/MrMe/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM\tools\sam_processing_algorithm.py", line 491, in processAlgorithm
self.sam_model = self.initialize_sam(
File "C:\Users/MrMe/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM\tools\sam_processing_algorithm.py", line 627, in initialize_sam
sam_model = sam_model_registry[model_type](
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\segment_anything\build_sam.py", line 38, in build_sam_vit_b
return _build_sam(
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\segment_anything\build_sam.py", line 105, in _build_sam
state_dict = torch.load(f)
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 1026, in load
return _load(opened_zipfile,
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 1438, in _load
result = unpickler.load()
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 1408, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 1382, in load_tensor
wrap_storage=restore_location(storage, location),
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 391, in default_restore_location
result = fn(storage, location)
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 266, in _cuda_deserialize
device = validate_cuda_device(location)
File "C:\Users\MrMe\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 250, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on a CUDA '
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.

Execution failed after 26.18 seconds

@Fanchengyan
Copy link
Collaborator

Hi @MohammadMr ,

Please check if you have selected the correct checkpoint : https://geo-sam.readthedocs.io/en/latest/Usage/encoding.html#download-sam-checkpoints

This appears to be a similar issue as problem #21 .

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

No branches or pull requests

2 participants