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

File "/root/TACL/train.py", line 60, in <module> objs.update(loss.data.item(), opt.batch_size) AttributeError: 'NoneType' object has no attribute 'data' #10

Open
jokeru8 opened this issue May 10, 2024 · 3 comments

Comments

@jokeru8
Copy link

jokeru8 commented May 10, 2024

When I run “python train.py --dataroot ./datasets/UIBED --name chinamm_train --model cycle_gan” ,the error occured :File "/root/TACL/train.py", line 60, in
objs.update(loss.data.item(), opt.batch_size)
AttributeError: 'NoneType' object has no attribute 'data'

@jokeru8 jokeru8 changed the title What's the meaning of dataset A and B File "/root/TACL/train.py", line 60, in <module> objs.update(loss.data.item(), opt.batch_size) AttributeError: 'NoneType' object has no attribute 'data' May 11, 2024
@342600694
Copy link

Hello, have you solved this problem yet

@342600694
Copy link

When I run “python train.py --dataroot ./datasets/UIBED --name chinamm_train --model cycle_gan” ,the error occured :File "/root/TACL/train.py", line 60, in objs.update(loss.data.item(), opt.batch_size) AttributeError: 'NoneType' object has no attribute 'data'

hey bro!The reason for this issue is that the model. optimize_marameters () on line 59 of train. py does not have a return value set in cycle_gan. You can obtain the loss by using loss=model. get_currentloss().

@Gai-shi
Copy link

Gai-shi commented Mar 9, 2025

当我运行“python train.py --dataroot ./datasets/UIBED --name chinamm_train --model cycle_gan”时,错误发生:文件"/root/TACL/train.py",第 60 行,在 objs.update(loss.data.item(), opt.batch_size)处,属性错误:"NoneType"对象没有"data"属性。

嘿,兄弟!这个问题出现的原因是 train.py 文件第 59 行的 model.optimize_marameters()函数在 cycle_gan 中没有设置返回值。你可以通过使用 loss=model.get_currentloss()来获取损失值。

AttributeError: 'CycleGANModel' object has no attribute 'get_currentloss'

I can't figure it out

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

3 participants