/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/metrics/bleu.py in accumulate(self)
230 logs = math.fsum(w_i * math.log(p_i)
231 for w_i, p_i in zip(self.weights, prob_list))
--> 232 if float(self.bp_c) != 0:
233 bp = math.exp(min(1 - self.bp_r / float(self.bp_c), 0))
234 else:
ZeroDivisionError: float division by zero
This error always raises even though I added if/else to prevent the situation that float(self.bp_c) is zero, but why there’s still weird ZeroDivisionError? Why the ‘->’ point to a line there’s no any division? I have no idea.
I run this project on BML CodeLab which is like jupyter notebook.but I don’t know how to add pdb and see the values. I can only fix some codes in cmd
New contributor
endless1winds is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.