diff --git a/pyproject.toml b/pyproject.toml index 4e0b1cbe..f8cc5ec5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,7 +118,7 @@ logging = [ "dvclive>=2.12.0", ] extra = [ - "hub-sdk>=0.0.8", # Ultralytics HUB + "hub-sdk>=0.0.12", # Ultralytics HUB "ipython", # interactive notebook "albumentations>=1.4.6", # training augmentations "pycocotools>=2.0.7", # COCO mAP diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 85944a54..fd8570e3 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.2.100" +__version__ = "8.2.101" import os diff --git a/ultralytics/engine/model.py b/ultralytics/engine/model.py index 67751889..fcafc9f7 100644 --- a/ultralytics/engine/model.py +++ b/ultralytics/engine/model.py @@ -127,7 +127,7 @@ class Model(nn.Module): # Check if Ultralytics HUB model from https://hub.ultralytics.com if self.is_hub_model(model): # Fetch model from HUB - checks.check_requirements("hub-sdk>=0.0.8") + checks.check_requirements("hub-sdk>=0.0.12") session = HUBTrainingSession.create_session(model) model = session.model_file if session.train_args: # training sent from HUB diff --git a/ultralytics/hub/__init__.py b/ultralytics/hub/__init__.py index 33b0c374..9c9c9dfa 100644 --- a/ultralytics/hub/__init__.py +++ b/ultralytics/hub/__init__.py @@ -38,7 +38,7 @@ def login(api_key: str = None, save=True) -> bool: Returns: (bool): True if authentication is successful, False otherwise. """ - checks.check_requirements("hub-sdk>=0.0.8") + checks.check_requirements("hub-sdk>=0.0.12") from hub_sdk import HUBClient api_key_url = f"{HUB_WEB_ROOT}/settings?tab=api+keys" # set the redirect URL diff --git a/ultralytics/hub/session.py b/ultralytics/hub/session.py index 170bb82b..89b5ddfc 100644 --- a/ultralytics/hub/session.py +++ b/ultralytics/hub/session.py @@ -63,22 +63,24 @@ class HUBTrainingSession: # Initialize client self.client = HUBClient(credentials) - # Load models if authenticated - if self.client.authenticated: + # Load models + try: if model_id: self.load_model(model_id) # load existing model else: self.model = self.client.model() # load empty model + except Exception: + if identifier.startswith(f"{HUB_WEB_ROOT}/models/") and not self.client.authenticated: + LOGGER.warning( + f"{PREFIX}WARNING ⚠️ Please log in using 'yolo login API_KEY'. " + "You can find your API Key at: https://hub.ultralytics.com/settings?tab=api+keys." + ) @classmethod def create_session(cls, identifier, args=None): """Class method to create an authenticated HUBTrainingSession or return None.""" try: session = cls(identifier) - if not session.client.authenticated: - if identifier.startswith(f"{HUB_WEB_ROOT}/models/"): - LOGGER.warning(f"{PREFIX}WARNING ⚠️ Login to Ultralytics HUB with 'yolo hub login API_KEY'.") - return None if args and not identifier.startswith(f"{HUB_WEB_ROOT}/models/"): # not a HUB model URL session.create_model(args) assert session.model.id, "HUB model not loaded correctly"