ultralytics 8.0.68 HUB zipfile without suffix fix (#1877)

Co-authored-by: Damiano Ferrari <34270884+ferraridamiano@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-04-06 22:55:49 +02:00
committed by GitHub
parent 2725545090
commit d3f097314f
5 changed files with 13 additions and 11 deletions

View File

@ -126,10 +126,10 @@ def safe_download(url,
raise ConnectionError(emojis(f'❌ Download failure for {url}. Retry limit reached.')) from e
LOGGER.warning(f'⚠️ Download failure, retrying {i + 1}/{retry} {url}...')
if unzip and f.exists() and f.suffix in ('.zip', '.tar', '.gz'):
if unzip and f.exists() and f.suffix in ('', '.zip', '.tar', '.gz'):
unzip_dir = dir or f.parent # unzip to dir if provided else unzip in place
LOGGER.info(f'Unzipping {f} to {unzip_dir}...')
if f.suffix == '.zip':
if is_zipfile(f):
unzip_dir = unzip_file(file=f, path=unzip_dir) # unzip
elif f.suffix == '.tar':
subprocess.run(['tar', 'xf', f, '--directory', unzip_dir], check=True) # unzip