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

关于train.py #47

Open
yoho131 opened this issue Sep 7, 2024 · 3 comments
Open

关于train.py #47

yoho131 opened this issue Sep 7, 2024 · 3 comments

Comments

@yoho131
Copy link

yoho131 commented Sep 7, 2024

作者你好,我在尝试训练我自己的数据集的时候出现了一些小问题。
当我尝试使用train.sh脚本的时候设备会重启,当我单独运行train.py的时候会报错如下:
1725684906783
能否解惑,万分感谢

@zqhang
Copy link
Owner

zqhang commented Sep 11, 2024

这个应该是text_prob和label的size不匹配,你打印这两个变量的shape看看

@LJK12581
Copy link

提问者您好,请问这个问题解决了嘛?

@yoho131
Copy link
Author

yoho131 commented Sep 19, 2024

我将train.py的83行
image_loss = F.cross_entropy(text_probs.squeeze(), label.long().cuda())
修改为
image_loss = F.cross_entropy(text_prob, label.long().cuda())
之后可以成功运行,但是我不知道这是否会对训练结果带来不利影响

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