Update tools.py

If you don't use the condition expression speed may be 0 initially

deep-person-reid-master\torchreid\utils\tools.py", line 86, in _reporthook
    speed = int(progress_size / (1024*duration))
ZeroDivisionError: float division by zero
pull/519/head
HanCheng 2022-08-15 16:43:02 +08:00 committed by GitHub
parent 91b032f392
commit be55021c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ def download_url(url, dst):
return
duration = time.time() - start_time
progress_size = int(count * block_size)
speed = int(progress_size / (1024*duration))
speed = 0 if duration == 0 else int(progress_size / (1024*duration))
percent = int(count * block_size * 100 / total_size)
sys.stdout.write(
'\r...%d%%, %d MB, %d KB/s, %d seconds passed' %