PJLab-ADG / neuralsim

neuralsim: 3D surface reconstruction and simulation based on 3D neural rendering.
MIT License
582 stars 31 forks source link

AssertionError: If capturable=True, params and state_steps must be CUDA tensors. #18

Open strualo opened 11 months ago

strualo commented 11 months ago

您好,我在执行train的时候遇到下面的报错: AssertionError: If capturable=True, params and state_steps must be CUDA tensors. 我查了相关的博客,大概定位到1.12.0 版本 torch 新引入的参数 capturable有关。 但是我根据: https://blog.csdn.net/weixin_44504393/article/details/131994326https://stackoverflow.com/questions/73095460/assertionerror-if-capturable-false-state-steps-should-not-be-cuda-tensors/73631359 里面的方法加了 optimizer.param_groups[0]['capturable'] = True 也不起作用 我的环境是ubuntu18.04 + 4090 +pytorch1.13+ cuda11.8

根据您的经验,还能是什么问题呢?

ventusff commented 11 months ago

你好,这里我有和你相同的经验,1.12 及以后的版本确实有这个问题,包括在 optimzer 参数中改了也不行,后来我们都用的 pytorch1.11,最近验证了 pytorch 2.0 也没问题。这里后面我们可以在细看下,如果可以的话你可以先换版本

strualo commented 11 months ago

但是nr3d_lib不是要求pytorch < 2.0吗

strualo commented 11 months ago

我在adam.py里面注释了

if capturable:

    #     assert param.is_cuda and step_t.is_cuda, "If capturable=True, params and state_steps must be CUDA tensors."

,可以跑起来了,就是不知道这么改有没有其他问题

ventusff commented 11 months ago

但是nr3d_lib不是要求pytorch < 2.0吗

readme 没及时更新,sorry

我在adam.py里面注释了 # if capturable: # assert param.is_cuda and step_t.is_cuda, "If capturable=True, params and state_steps must be CUDA tensors." ,可以跑起来了,就是不知道这么改有没有其他问题

这个就是 pytorch 的问题了,我后面看下