Fixed the ZeroDivisionError when downloading a model (#2797)

This commit is contained in:
Gaurav Bhagchandani 2023-06-21 11:31:50 -04:00 committed by GitHub
parent 90be1d9fe1
commit 89fb6f9236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ class ModelDownloader:
for data in r.iter_content(block_size): for data in r.iter_content(block_size):
t.update(len(data)) t.update(len(data))
f.write(data) f.write(data)
if self.progress_bar is not None: if total_size != 0 and self.progress_bar is not None:
count += len(data) count += len(data)
self.progress_bar(float(count) / float(total_size), f"Downloading {filename}") self.progress_bar(float(count) / float(total_size), f"Downloading {filename}")