From b4be85a18f52da97ab6b076796123b434981a9ab Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 1 May 2021 12:37:41 +0200 Subject: [PATCH] Add unzip flag to download() (#3002) --- utils/general.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/general.py b/utils/general.py index bad20bbedd44..7e50a7333dea 100755 --- a/utils/general.py +++ b/utils/general.py @@ -183,7 +183,7 @@ def check_dataset(dict): raise Exception('Dataset not found.') -def download(url, dir='.', threads=1): +def download(url, dir='.', unzip=True, threads=1): # Multi-threaded file download and unzip function def download_one(url, dir): # Download 1 file @@ -191,7 +191,7 @@ def download_one(url, dir): if not f.exists(): print(f'Downloading {url} to {f}...') torch.hub.download_url_to_file(url, f, progress=True) # download - if f.suffix in ('.zip', '.gz'): + if unzip and f.suffix in ('.zip', '.gz'): print(f'Unzipping {f}...') if f.suffix == '.zip': os.system(f'unzip -qo {f} -d {dir} && rm {f}') # unzip -quiet -overwrite