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

训练报错,(并非完全在GPU上)Expected all tensors to be on the same device, but found at least two devices, cuda:2 and cpu! #3

Open
lkw666 opened this issue Oct 14, 2022 · 4 comments

Comments

@lkw666
Copy link

lkw666 commented Oct 14, 2022

大佬,在跑 该项目时遇到一个问题,不是很理解 为什么会出现有不在GPU上的情况呢?
2022-10-14_170606

还一个小问题,看到大佬的环境是双GPU训练,该代码为但gpu训练吗?

@Ye-zixiao
Copy link
Owner

1)有些tensor确实是放在cpu上,有些则是放在cpu,比如简单计算的时候就是放在cpu上计算,放在gpu就是选cuda:0,放在cpu就写cpu或者不写;2)因为之前写代码的时候确实单gpu训练的,后来那两块gpu是老师给我申请过来的,所以默认就是传上来的就是单gpu的代码。

@QRvlS
Copy link

QRvlS commented Mar 7, 2023

我也遇到了这个问题,请大大们问要怎么解决啊!尝试了几种办法把x和module移动到GPU上后还是报错

@zheng-zf
Copy link

zheng-zf commented Mar 7, 2023

我也遇到了这个问题,请大大们问要怎么解决啊!尝试了几种办法把x和module移动到GPU上后还是报错
把这一行代码注释就好了 self.info(verbose)

@QRvlS
Copy link

QRvlS commented Mar 8, 2023

我也遇到了这个问题,请大大们问要怎么解决啊!尝试了几种办法把x和module移动到GPU上后还是报错
把这一行代码注释就好了 self.info(verbose)

完美解决了!太厉害了大大!谢谢谢谢!

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

4 participants