ZeroDivisionError: division by zero
Delimeng opened this issue · 6 comments
Traceback (most recent call last):
File "D:\desktop\GPT2-chitchat-master\train.py", line 427, in
main()
File "D:\desktop\GPT2-chitchat-master\train.py", line 423, in main
train(model, logger, train_dataset, validate_dataset, args)
File "D:\desktop\GPT2-chitchat-master\train.py", line 298, in train
validate_loss = validate_epoch(
File "D:\desktop\GPT2-chitchat-master\train.py", line 251, in validate_epoch
epoch_mean_loss = total_loss / len(validate_dataloader)
ZeroDivisionError: division by zero
how to solve the problem?I hope someone can help me.
问题解决了,是因为自己的语料太少了,可以增加一下语料的数量
1,他这个报错的原因就是分母的值为零,你加上一个很小的值确实会避免这个错误,但是对于模型的训练来说准确度很重要。
2,另外增加语料没有解决这个问题的话,还是你增加的语料的数量太少了,我的建议是你不要手动去增加语料,你去作者的链接里面找一下,我记得有语料的压缩包,把它下载下来。