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

lm_loss类型是str,无法计算loss #110

Open
ziqing0701 opened this issue Mar 6, 2023 · 2 comments
Open

lm_loss类型是str,无法计算loss #110

ziqing0701 opened this issue Mar 6, 2023 · 2 comments

Comments

@ziqing0701
Copy link

您好,我在运行train()时报错 TypeError: unsupported operand type(s) for /: 'str' and 'int'
(lm_loss), *_ = model(input_ids, labels=lm_labels, token_type_ids=token_type_ids)
loss = lm_loss / args.gradient_accumulation_steps

debug发现lm_loss 是str类型,请问是哪里出错了。
用的预训练thu-coai/CDial-GPT_LCCC-base模型,"--data_path"是"data/STC.json"

谢谢!

@YuChuXi
Copy link

YuChuXi commented May 13, 2023

model(...)换成model.forward(...)试试

@ziqing0701
Copy link
Author

ziqing0701 commented May 13, 2023 via email

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