Skip to content

RuntimeError on MacOs: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. #97

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

Open
deadcat000 opened this issue Jan 23, 2025 · 1 comment

Comments

@deadcat000
Copy link

Not able to make it run on my M1Max anymore. I am using the latest stable torch.

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.

grounding-dino is using models/bert-base-uncased
final text_encoder_type: /Users/nicola/ComfyUI/models/bert-base-uncased
using extra model: /Users/nicola/ComfyUI/models/sams/sam_hq_vit_h.pth
!!! Exception during processing !!! 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.
Traceback (most recent call last):
File "/Users/nicola/ComfyUI/execution.py", line 323, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/Users/nicola/ComfyUI/execution.py", line 198, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/Users/nicola/ComfyUI/execution.py", line 169, in _map_node_over_list
process_inputs(input_dict, i)
File "/Users/nicola/ComfyUI/execution.py", line 158, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "/Users/nicola/ComfyUI/custom_nodes/comfyui_segment_anything/node.py", line 269, in main
sam_model = load_sam_model(model_name)
File "/Users/nicola/ComfyUI/custom_nodes/comfyui_segment_anything/node.py", line 86, in load_sam_model
sam = sam_model_registrymodel_type
File "/Users/nicola/ComfyUI/custom_nodes/comfyui_segment_anything/sam_hq/build_sam_hq.py", line 19, in build_sam_hq_vit_h
return _build_sam_hq(
File "/Users/nicola/ComfyUI/custom_nodes/comfyui_segment_anything/sam_hq/build_sam_hq.py", line 122, in _build_sam_hq
return _load_sam_checkpoint(sam, checkpoint)
File "/Users/nicola/ComfyUI/custom_nodes/comfyui_segment_anything/sam_hq/build_sam_hq.py", line 67, in _load_sam_checkpoint
state_dict = torch.load(f)
File "/Users/nicola/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/impact/subcore.py", line 24, in torch_wrapper
return orig_torch_load(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 1465, in load
return _load(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 1953, in _load
result = unpickler.load()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 1917, in persistent_load
typed_storage = load_tensor(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 1889, in load_tensor
wrap_storage=restore_location(storage, location),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 686, in default_restore_location
result = fn(storage, location)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 624, in _deserialize
device = _validate_device(location, backend_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 593, in _validate_device
raise RuntimeError(
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.

@zhangjiabin1010
Copy link

same question

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