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: invalid device ordinal #17

Open
yinzhiqiangluvlzx opened this issue Nov 7, 2020 · 3 comments
Open

RuntimeError: CUDA error: invalid device ordinal #17

yinzhiqiangluvlzx opened this issue Nov 7, 2020 · 3 comments

Comments

@yinzhiqiangluvlzx
Copy link

作者,您好。我在使用DeepCoNN训练模型的时候需要RuntimeError: CUDA error: invalid device ordinal问题,搜索了一圈没有有效的方法,想请教您帮我看看,十分感谢!
(pytorch) D:\workspace\pycharm\Neu-Review-Rec>python main.py train --model=DeepCoNN --num_fea=1 --output=fm
load npy from dist...


user config:
vocab_size => 50002
word_dim => 300
r_max_len => 202
u_max_r => 13
i_max_r => 24
train_data_size => 51764
test_data_size => 6471
val_data_size => 6471
user_num => 5543
item_num => 3570
batch_size => 128
print_step => 100


Traceback (most recent call last):
File "main.py", line 212, in
fire.Fire()
File "C:\Users\yinzhiqiang\anaconda3\envs\pytorch\lib\site-packages\fire\core.py", line 138, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "C:\Users\yinzhiqiang\anaconda3\envs\pytorch\lib\site-packages\fire\core.py", line 468, in _Fire
target=component.name)
File "C:\Users\yinzhiqiang\anaconda3\envs\pytorch\lib\site-packages\fire\core.py", line 672, in CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "main.py", line 43, in train
torch.cuda.set_device(opt.gpu_id)
File "C:\Users\yinzhiqiang\anaconda3\envs\pytorch\lib\site-packages\torch\cuda_init
.py", line 263, in set_device
torch._C._cuda_setDevice(device)
RuntimeError: CUDA error: invalid device ordinal

@ShomyLiu
Copy link
Owner

ShomyLiu commented Nov 7, 2020

你好,配置文件中默认的gpu_id设置为1, 如果机器只有一个显卡的话,需要设置为0.

@yinzhiqiangluvlzx
Copy link
Author

谢谢您的解答!问题已经解决了,十分感谢!期待您后续把其他算法完善!

@ShomyLiu
Copy link
Owner

ShomyLiu commented Nov 7, 2020

争取年前可以完成,欢迎提PR

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