-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Curated hub improvements #4760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Curated hub improvements #4760
Conversation
6d6345c
to
5392504
Compare
…y due to the circular dependancy issue
c1cae63
to
39a22fb
Compare
39a22fb
to
3fe2774
Compare
src/sagemaker/jumpstart/hub/hub.py
Outdated
@@ -68,7 +67,9 @@ def __init__( | |||
self, | |||
hub_name: str, | |||
bucket_name: Optional[str] = None, | |||
sagemaker_session: Optional[Session] = DEFAULT_JUMPSTART_SAGEMAKER_SESSION, | |||
sagemaker_session: Optional[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wouldn't set this as a default argument since this function will get invoked whenever the module is imported, which may cause slow latency or errors on some systems. can you set in constructor body instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks changed it in the new revision
src/sagemaker/jumpstart/utils.py
Outdated
|
||
if os.getenv(constants.ENV_VARIABLE_DISABLE_JUMPSTART_TELEMETRY, None): | ||
headers = sagemaker_python_sdk_headers | ||
elif model_id is None and model_version is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we only add the tag md/js_is_hub_content
if it is a hub content? we don't want to add unnecessary characters to the user agent, there's a char limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks changed it in the new revision
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good over all
src/sagemaker/jumpstart/accessors.py
Outdated
"Recieved exeption while calling APIs for ContentType Model, \ | ||
retrying with ContentType ModelReference: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it other way around. The code is first attempting using ModelReference and then as Model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh yeah I forgot I changed it recently, let me correct this. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also identified one more place where we were trying with Model first and then ModelRef. Changed that as well, in the Hub class. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful with backward compatibility
src/sagemaker/jumpstart/accessors.py
Outdated
@@ -307,6 +299,21 @@ def get_model_specs( | |||
model_specs.set_hub_content_type(HubContentType.MODEL_REFERENCE) | |||
return model_specs | |||
|
|||
except Exception as ex: | |||
logging.info( | |||
"Recieved exeption while calling APIs for ContentType ModelReference, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Recieved
- please also check error message with @judyheflin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, high-level question for future PRs: shall we retry on all types of error? As in, if retry throttling as well?
That may be fine, but just want to make sure that's a conscious decision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think its fine to retry on all error types but now that I am thinking about it I feel like I can just restrict retry with a different contentType only in the case of ResourceNotFound errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regardless engaging with @judyheflin for the error message
) | ||
|
||
except Exception as ex: | ||
logging.info("Recieved expection while calling APIs for ContentType Model: " + str(ex)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
src/sagemaker/jumpstart/hub/hub.py
Outdated
) | ||
|
||
except Exception as ex: | ||
logging.info("Recieved expection while calling APIs for ContentType Model: " + str(ex)) | ||
logging.info( | ||
"Recieved exeption while calling APIs for ContentType ModelReference, retrying with ContentType Model: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
src/sagemaker/jumpstart/hub/utils.py
Outdated
"""Returns available Jumpstart hub model version | ||
|
||
Raises: | ||
ResourceNotFound: If the specified model is not found in the hub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the exception type should be a Python class, not the error returned by the API.
Doesn't this method raise or Exception
, KeyError
or potentially a ClientException
on line 203?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes my bad, updated it to ClientError exception instead
src/sagemaker/jumpstart/model.py
Outdated
@@ -429,6 +429,7 @@ def attach( | |||
cls, | |||
endpoint_name: str, | |||
inference_component_name: Optional[str] = None, | |||
hub_name: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backward-incompatible change, please add arg to the end of the list.
Issue #, if available:
Description of changes:
Testing done:
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
unique_name_from_base
to create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.