Skip to content

Commit

Permalink
fix download bug
Browse files Browse the repository at this point in the history
  • Loading branch information
opqrst-chen committed Jul 12, 2024
1 parent c47cd6b commit 9854d59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions batteryml/preprocess/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,16 @@ def memory2str(mem):
counter += 1
bar.update(len(data))
if counter % update_interval == 0:
ellapsed = time.time() - now_time
elapsed = time.time() - now_time
runtime_downloaded = downloaded - now_size
now_time, now_size = time.time(), downloaded

cur_size = memory2str(downloaded)
speed_size = memory2str(runtime_downloaded / ellapsed)
if elapsed > 0:
speed_size = memory2str(
runtime_downloaded / elapsed)
else:
speed_size = '0B/s'
bar.set_description(f'{cur_size}/{total_size}')
bar.set_postfix_str(f'{speed_size}/s')

Expand Down

0 comments on commit 9854d59

Please sign in to comment.