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

RuntimeError: CUDA error: unknown error #12

Closed
Skymu opened this issue May 2, 2020 · 2 comments
Closed

RuntimeError: CUDA error: unknown error #12

Skymu opened this issue May 2, 2020 · 2 comments

Comments

@Skymu
Copy link

Skymu commented May 2, 2020

Hello! Thanks for your work.
But I have a problem while using "python main.py --mode animation"
I test with cuda9.0 cuda10.0 and cuda10.1 but result in the same error, how can I solve this problem?

Training images: 156295
Testing images: 100
Model running on cuda:0
Traceback (most recent call last):
File "main.py", line 60, in
main(config)
File "main.py", line 25, in main
solver = Solver(data_loader, config_dict)
File "C:\Users\15974\Desktop\ganimation-master\solver.py", line 35, in init
self.build_model()
File "C:\Users\15974\Desktop\ganimation-master\utils.py", line 17, in build_model
self.g_repeat_num).to(self.device)
File "D:\tools\anaconda3\envs\gan\lib\site-packages\torch\nn\modules\module.py", line 386, in to
return self._apply(convert)
File "D:\tools\anaconda3\envs\gan\lib\site-packages\torch\nn\modules\module.py", line 193, in _apply
module._apply(fn)
File "D:\tools\anaconda3\envs\gan\lib\site-packages\torch\nn\modules\module.py", line 193, in _apply
module._apply(fn)
File "D:\tools\anaconda3\envs\gan\lib\site-packages\torch\nn\modules\module.py", line 199, in apply
param.data = fn(param.data)
File "D:\tools\anaconda3\envs\gan\lib\site-packages\torch\nn\modules\module.py", line 384, in convert
return t.to(device, dtype if t.is_floating_point() else None, non_blocking)
File "D:\tools\anaconda3\envs\gan\lib\site-packages\torch\cuda_init
.py", line 163, in _lazy_init
torch._C._cuda_init()
RuntimeError: CUDA error: unknown error

@vipermu
Copy link
Owner

vipermu commented May 2, 2020

Have you tried to substitute .to(self.device) for .cuda() in line 17 from C:\Users\15974\Desktop\ganimation-master\utils.py ?

It might be the case that the id of your GPU is different from 0?

@Skymu
Copy link
Author

Skymu commented May 2, 2020

Thanks a lot!
I have solve this problem by adding

torch.cuda.current_device()
torch.cuda._initialized = True

@vipermu vipermu closed this as completed May 18, 2020
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