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

CUDA error #43

Open
AbangTan opened this issue Jun 30, 2023 · 1 comment
Open

CUDA error #43

AbangTan opened this issue Jun 30, 2023 · 1 comment

Comments

@AbangTan
Copy link

I am running on a macbook pro m2 and I met with the cuda problem. The error is as below:

___________________________start
tanyihan@ID-4289M Adeleine % python3 server.py --point ckpts/point_model.pt
Using cache found in /Users/tanyihan/.cache/torch/hub/RF5_danbooru-pretrained_master
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
warnings.warn(
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None.
warnings.warn(msg)
Traceback (most recent call last):
File "/Users/tanyihan/Documents/adeleine/Adeleine/server.py", line 213, in
main(args)
File "/Users/tanyihan/Documents/adeleine/Adeleine/server.py", line 31, in main
point_infer = PointInferer(str(args.point))
File "/Users/tanyihan/Documents/adeleine/Adeleine/point/inference.py", line 15, in init
self.model = self._model_load(pretrain_path)
File "/Users/tanyihan/Documents/adeleine/Adeleine/point/inference.py", line 24, in _model_load
model = Generator(in_ch=5,
File "/Users/tanyihan/Documents/adeleine/Adeleine/point/model.py", line 653, in init
self.se = AtariEncoder(out_ch=base*8,
File "/Users/tanyihan/Documents/adeleine/Adeleine/point/model.py", line 557, in init
ResNet(),
File "/Users/tanyihan/Documents/adeleine/Adeleine/point/model.py", line 163, in init
self.model = torch.hub.load('RF5/danbooru-pretrained', 'resnet50')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/hub.py", line 558, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/hub.py", line 587, in _load_local
model = entry(*args, **kwargs)
File "/Users/tanyihan/.cache/torch/hub/RF5_danbooru-pretrained_master/danbooru_resnet.py", line 133, in resnet50
state = torch.hub.load_state_dict_from_url("https://github.com/RF5/danbooru-pretrained/releases/download/v0.1/resnet50-13306192.pth",
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/hub.py", line 750, in load_state_dict_from_url
return torch.load(cached_file, map_location=map_location)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 815, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 1043, in _legacy_load
result = unpickler.load()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 980, in persistent_load
wrap_storage=restore_location(obj, location),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 217, 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 182, in _cuda_deserialize
device = validate_cuda_device(location)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/serialization.py", line 166, 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.
___________________________end

Do I need a laptop with NVIDIA to run this code?

@SerialLain3170
Copy link
Owner

Hello,

Yes, the current code requires NVIDIA GPU. Of course, you can rewrite the code so that you can run without GPU by following the error message or by removing the .cuda() etc.

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