Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Add scaling to tqdm bar when downloading files #5397

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion allennlp/common/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _http_get(url: str, temp_file: IO) -> None:
req.raise_for_status()
content_length = req.headers.get("Content-Length")
total = int(content_length) if content_length is not None else None
progress = Tqdm.tqdm(unit="B", total=total, desc="downloading")
progress = Tqdm.tqdm(unit="B", unit_scale=True, total=total, desc="downloading")
for chunk in req.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
progress.update(len(chunk))
Expand Down