Merge pull request #8 from raviv/master

Fix for division by zero in model download speed calculation
This commit is contained in:
Allegro AI 2019-06-19 15:10:00 +03:00 committed by GitHub
commit dce1f6b7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,8 @@ class _DownloadProgressReport(object):
last_part = self.downloaded_mb - self.last_reported
if self._verbose or (last_part >= self._report_chunk_size):
speed = last_part / (time() - self._tic)
time_diff = time() - self._tic
speed = (last_part / time_diff) if time_diff != 0 else 0
self._tic = time()
self.last_reported = self.downloaded_mb
self._log.info('Downloading: %.0fMB / %.2fMb @ %.2fMbs from %s' %