From 40b3c1bd72f4bca67d831d00406cbefeb48274c8 Mon Sep 17 00:00:00 2001 From: 46319943 <495384481@qq.com> Date: Wed, 19 Apr 2023 21:59:57 +0800 Subject: [PATCH] Fix progress bar unit. --- paddlespeech/cli/download.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paddlespeech/cli/download.py b/paddlespeech/cli/download.py index 5661f18f9..958560e72 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: - for chunk in req.iter_content(chunk_size=1024): + with tqdm(total=(int(total_size))) as pbar: + for chunk in req.iter_content(chunk_size=1024, unit='B', unit_scale=True): f.write(chunk) - pbar.update(1) + pbar.update(len(chunk)) else: for chunk in req.iter_content(chunk_size=1024): if chunk: