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

Divide by zero at line 695 in PosteriorBias/baseline_crf_prob.py #3

Open
ghzhang233 opened this issue Oct 8, 2020 · 2 comments
Open
Assignees

Comments

@ghzhang233
Copy link

verb_1, value_1, loss.item(), loss_total / ((total_steps) % (eval_frequency*len(train_loader) + 1)), (time.time() - time_all)))

It seems like that it should be
loss_total / ((total_steps - 1) % (eval_frequency*len(train_loader)) + 1)
rather than
loss_total / ((total_steps) % (eval_frequency*len(train_loader) + 1))
if I understand correctly.

@MtSomeThree
Copy link
Contributor

Thanks for catching. It should be the second one, but neither of them will cause the divide-by-zero issue since the denominators are both >= 1. Could you check the eval_frequency or len(train_loader) value?

@ghzhang233
Copy link
Author

ghzhang233 commented Nov 11, 2020

Hi, @MtSomeThree ,
Thank you for replying!
For the code,
loss_total / ((total_steps) % (eval_frequency*len(train_loader) + 1))
please note that total_steps % (eval_frequency*len(train_loader) + 1) can be zero, as +1 is in the bracket.

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