Skip to content

Commit

Permalink
Merge pull request #45 from opqrst-chen/fix-download-bug
Browse files Browse the repository at this point in the history
fix download bug
  • Loading branch information
agiamason authored Jul 15, 2024
2 parents c47cd6b + 9854d59 commit 90b85fb
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 90b85fb

Please sign in to comment.