From 6e639986aabf511def859a8f89e68aba50169d9e Mon Sep 17 00:00:00 2001 From: PiaoYang <495384481@qq.com> Date: Thu, 20 Apr 2023 14:17:01 +0800 Subject: [PATCH] [BUG] Fix progress bar unit. (#3177) --- paddlespeech/cli/download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paddlespeech/cli/download.py b/paddlespeech/cli/download.py index 5661f18f9..e77a05d2e 100644 --- a/paddlespeech/cli/download.py +++ b/paddlespeech/cli/download.py @@ -133,10 +133,10 @@ def _get_download(url, fullname): total_size = req.headers.get('content-length') with open(tmp_fullname, 'wb') as f: if total_size: - with tqdm(total=(int(total_size) + 1023) // 1024) as pbar: + with tqdm(total=(int(total_size)), unit='B', unit_scale=True) as pbar: for chunk in req.iter_content(chunk_size=1024): f.write(chunk) - pbar.update(1) + pbar.update(len(chunk)) else: for chunk in req.iter_content(chunk_size=1024): if chunk: