From 91e27a6e64048f539bd9145796dd7a96b2ac5c4c Mon Sep 17 00:00:00 2001 From: Emily Dinan Date: Fri, 26 Mar 2021 13:06:29 -0400 Subject: [PATCH] prevent division by zero --- parlai/scripts/train_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parlai/scripts/train_model.py b/parlai/scripts/train_model.py index 7c2e6d76a61..fd078c4ecbf 100644 --- a/parlai/scripts/train_model.py +++ b/parlai/scripts/train_model.py @@ -681,7 +681,7 @@ def _compute_eta( eta = time_left max_train_steps = self.opt.get('max_train_steps', -1) - if max_train_steps > 0: + if max_train_steps > 0 and steps_taken > 0: steps_progress = steps_taken / max_train_steps eta = (1 - steps_progress) * time_elapsed / steps_progress