Skip to content

Commit

Permalink
Add datetime formatting for ETA time. (keras-team#8219)
Browse files Browse the repository at this point in the history
  • Loading branch information
hgaiser authored and fchollet committed Oct 24, 2017
1 parent e83041f commit 5ca4f74
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion keras/utils/generic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,15 @@ def update(self, current, values=None, force=False):
time_per_unit = 0
if self.target is not None and current <= self.target:
eta = time_per_unit * (self.target - current)
info = ' - ETA: %0.fs' % eta

if eta > 3600:
eta_format = '%d:%02d:%02d' % (eta // 3600, (eta % 3600) // 60, eta % 60)
elif eta > 60:
eta_format = '%d:%02d' % (eta // 60, eta % 60)
else:
eta_format = '%ds' % eta

info = ' - ETA: %s' % eta_format
for k in self.unique_values:
info += ' - %s:' % k
if isinstance(self.sum_values[k], list):
Expand Down

0 comments on commit 5ca4f74

Please sign in to comment.