`ultralytics 8.0.68` HUB zipfile without suffix fix (#1877)

Co-authored-by: Damiano Ferrari <34270884+ferraridamiano@users.noreply.github.com>
pull/1884/head v8.0.68
Glenn Jocher 2 years ago committed by GitHub
parent 2725545090
commit d3f097314f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      docs/tasks/pose.md
  2. 2
      ultralytics/__init__.py
  3. 10
      ultralytics/hub/auth.py
  4. 2
      ultralytics/hub/session.py
  5. 4
      ultralytics/yolo/utils/downloads.py

@ -62,13 +62,13 @@ Train a YOLOv8-pose model on the COCO128-pose dataset.
```bash
# Build a new model from YAML and start training from scratch
yolo detect train data=coco128-pose.yaml model=yolov8n-pose.yaml epochs=100 imgsz=640
yolo pose train data=coco128-pose.yaml model=yolov8n-pose.yaml epochs=100 imgsz=640
# Start training from a pretrained *.pt model
yolo detect train data=coco128-pose.yaml model=yolov8n-pose.pt epochs=100 imgsz=640
yolo pose train data=coco128-pose.yaml model=yolov8n-pose.pt epochs=100 imgsz=640
# Build a new model from YAML, transfer pretrained weights to it and start training
yolo detect train data=coco128-pose.yaml model=yolov8n-pose.yaml pretrained=yolov8n-pose.pt epochs=100 imgsz=640
yolo pose train data=coco128-pose.yaml model=yolov8n-pose.yaml pretrained=yolov8n-pose.pt epochs=100 imgsz=640
```
## Val

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
__version__ = '8.0.67'
__version__ = '8.0.68'
from ultralytics.hub import start
from ultralytics.yolo.engine.model import YOLO

@ -11,7 +11,7 @@ API_KEY_URL = 'https://hub.ultralytics.com/settings?tab=api+keys'
class Auth:
id_token = api_key = model_key = False
def __init__(self, api_key=''):
def __init__(self, api_key='', verbose=True):
"""
Initialize the Auth class with an optional API key.
@ -29,7 +29,8 @@ class Auth:
# If the provided API key matches the API key in the SETTINGS
if self.api_key == SETTINGS.get('api_key'):
# Log that the user is already logged in
LOGGER.info(f'{PREFIX}Authenticated ✅')
if verbose:
LOGGER.info(f'{PREFIX}Authenticated ✅')
return
else:
# Attempt to authenticate with the provided API key
@ -46,8 +47,9 @@ class Auth:
if success:
set_settings({'api_key': self.api_key})
# Log that the new login was successful
LOGGER.info(f'{PREFIX}New authentication successful ✅')
else:
if verbose:
LOGGER.info(f'{PREFIX}New authentication successful ✅')
elif verbose:
LOGGER.info(f'{PREFIX}Retrieve API key from {API_KEY_URL}')
def request_api_key(self, max_attempts=3):

@ -58,7 +58,7 @@ class HUBTrainingSession:
raise ValueError(f'Invalid HUBTrainingSession input: {url}')
# Authorize
auth = Auth(key)
auth = Auth(key, verbose=False)
self.agent_id = None # identifies which instance is communicating with server
self.model_id = model_id
self.model_url = f'https://hub.ultralytics.com/models/{model_id}'

@ -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

Loading…
Cancel
Save