Skip to content

Commit

Permalink
Add .tar support for datasets (#8963)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Aug 14, 2022
1 parent 3fc8999 commit d7bc5d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,12 @@ def download_one(url, dir):
else:
LOGGER.warning(f'Failed to download {url}...')

if unzip and success and f.suffix in ('.zip', '.gz'):
if unzip and success and f.suffix in ('.zip', '.tar', '.gz'):
LOGGER.info(f'Unzipping {f}...')
if f.suffix == '.zip':
ZipFile(f).extractall(path=dir) # unzip
elif f.suffix == '.tar':
os.system(f'tar xf {f} --directory {f.parent}') # unzip
elif f.suffix == '.gz':
os.system(f'tar xfz {f} --directory {f.parent}') # unzip
if delete:
Expand Down

0 comments on commit d7bc5d7

Please sign in to comment.