Add HUB-SDK Docs reference section (#7781)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
This commit is contained in:
parent
5941128835
commit
ee88882874
25 changed files with 142 additions and 47 deletions
|
|
@ -12,13 +12,16 @@ def login(api_key: str = None, save=True) -> bool:
|
|||
"""
|
||||
Log in to the Ultralytics HUB API using the provided API key.
|
||||
|
||||
The session is not stored; a new session is created when needed using the saved SETTINGS or the HUB_API_KEY environment variable if successfully authenticated.
|
||||
The session is not stored; a new session is created when needed using the saved SETTINGS or the HUB_API_KEY
|
||||
environment variable if successfully authenticated.
|
||||
|
||||
Args:
|
||||
api_key (str, optional): The API key to use for authentication. If not provided, it will be retrieved from SETTINGS or HUB_API_KEY environment variable.
|
||||
api_key (str, optional): API key to use for authentication.
|
||||
If not provided, it will be retrieved from SETTINGS or HUB_API_KEY environment variable.
|
||||
save (bool, optional): Whether to save the API key to SETTINGS if authentication is successful.
|
||||
|
||||
Returns:
|
||||
bool: True if authentication is successful, False otherwise.
|
||||
(bool): True if authentication is successful, False otherwise.
|
||||
"""
|
||||
checks.check_requirements("hub-sdk>=0.0.2")
|
||||
from hub_sdk import HUBClient
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class Auth:
|
|||
Attempt to authenticate with the server using either id_token or API key.
|
||||
|
||||
Returns:
|
||||
bool: True if authentication is successful, False otherwise.
|
||||
(bool): True if authentication is successful, False otherwise.
|
||||
"""
|
||||
try:
|
||||
if header := self.get_auth_header():
|
||||
|
|
@ -107,7 +107,7 @@ class Auth:
|
|||
supported browser.
|
||||
|
||||
Returns:
|
||||
bool: True if authentication is successful, False otherwise.
|
||||
(bool): True if authentication is successful, False otherwise.
|
||||
"""
|
||||
if not is_colab():
|
||||
return False # Currently only works with Colab
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ class HUBTrainingSession:
|
|||
timeout: The maximum timeout duration.
|
||||
|
||||
Returns:
|
||||
str: The retry message.
|
||||
(str): The retry message.
|
||||
"""
|
||||
if self._should_retry(response.status_code):
|
||||
return f"Retrying {retry}x for {timeout}s." if retry else ""
|
||||
|
|
@ -341,7 +341,7 @@ class HUBTrainingSession:
|
|||
response (requests.Response): The response object from the file download request.
|
||||
|
||||
Returns:
|
||||
(None)
|
||||
None
|
||||
"""
|
||||
with TQDM(total=content_length, unit="B", unit_scale=True, unit_divisor=1024) as pbar:
|
||||
for data in response.iter_content(chunk_size=1024):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue