From c7641318d5adab113c11144026359e2647b69b62 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Tue, 16 May 2023 08:40:29 -0500 Subject: [PATCH] Increase downloader chunk size --- disco_utils.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/disco_utils.py b/disco_utils.py index 51e08c8..a5d986d 100644 --- a/disco_utils.py +++ b/disco_utils.py @@ -199,13 +199,15 @@ def pyget(url, path=None, filename=None, progress=True): pbar = comfy.utils.ProgressBar(total_size_in_bytes) tqdm_bar = tqdm.tqdm(total=total_size_in_bytes, unit='iB', unit_scale=True) os.makedirs(os.path.dirname(path), exist_ok=True) + chunk_size = 10 * 1024 * 1024 with open(path, 'wb') as file: - for chunk in response.iter_content(1024): - if progress: - chunk_length = len(chunk) - tqdm_bar.update(chunk_length) - pbar.update(chunk_length) - file.write(chunk) + for chunk in response.iter_content(chunk_size): + if chunk: + if progress: + chunk_length = len(chunk) + tqdm_bar.update(chunk_length) + pbar.update(chunk_length) + file.write(chunk) if os.path.exists(path): return True else: