-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: jumpstart model artifact instance type variants #4172
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: jumpstart model artifact instance type variants #4172
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
""" | ||
|
||
return self._get_instance_specific_property( | ||
instance_type=instance_type, property_name="prepacked_artifact_key" |
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.
nit: should the property name include s3
?
instance_type=instance_type | ||
) | ||
if instance_type | ||
and getattr(model_specs, "hosting_instance_type_variants", None) is not 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.
Isn't the name of the property hosting_custom_instance_type_variants
in the MH PR?
model_artifact_key = ( | ||
getattr(model_specs, "hosting_prepacked_artifact_key", None) | ||
or model_specs.hosting_artifact_key | ||
instance_specific_prepacked_hosting_artifact_key |
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 think this logic can break if there is an instance-specific normal artifact but a default prepacked artifact. Previously, just the presence of default prepacked artifact would have indicated a need to prepack.
To be exact, we need to change the execution flow based on whether model_specs
is prepacked or not. Quick-and-dirty approach would be something like:
is_prepacked = model_specs.hosting_use_script_uri or default_prepacked_hosting_artifact_key
if is_prepacked:
return instance_specific_prepack_key or default_prepacked_hosting_artifact_key
else:
return instance_specific_key or default_hosting_artifact_key
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
Could you add specific unit tests for (a) sagemaker/model_uri
and (b) ssagemaker/jumpstart/artifacts/model_uris
please?
I know you are implicitely testing through JumpStartModel
and JumpStartEstimator
, but we should guard ourselves against specific logic introduced in these classes and test the utilities directly as well.
@@ -50,6 +51,8 @@ def _retrieve_model_uri( | |||
artifact S3 URI. | |||
model_scope (str): The model type, i.e. what it is used for. | |||
Valid values: "training" and "inference". | |||
instance_type (str): An instance type to optionally supply in order to get | |||
model artifacts specific for the instance type. (Default: 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.
Optional. The ML compute instance type for the specified scope. (Default: None).
src/sagemaker/model_uris.py
Outdated
@@ -44,6 +45,8 @@ def retrieve( | |||
the model artifact S3 URI. | |||
model_scope (str): The model type. | |||
Valid values: "training" and "inference". | |||
instance_type (str): An instance type to optionally supply in order to get | |||
model artifacts specific for the instance type. (Default: 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.
same comment here.
"properties": {"environment_variables": {"TENSOR_PARALLEL_DEGREE": "8"}} | ||
}, | ||
"ml.g5.12xlarge": { | ||
"properties": {"environment_variables": {"TENSOR_PARALLEL_DEGREE": "4"}} |
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.
could you add a test with an instance specific prepacked_artifact_key
as well please?
As in not just instance family variant please.
Same for training case please
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
Could you update the docstring as well please?
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
a54ab0a
to
11e20e5
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…act-instance-type-variants
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
/bot run slow-tests
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
/bot run pr
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
/bot run pr
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@evakravi Can you resolve conflicts on this PR? |
…act-instance-type-variants
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4172 +/- ##
==========================================
+ Coverage 90.27% 90.33% +0.06%
==========================================
Files 993 320 -673
Lines 87861 29586 -58275
==========================================
- Hits 79313 26726 -52587
+ Misses 8548 2860 -5688
☔ View full report in Codecov by Sentry. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue #, if available:
Description of changes:
JumpStart plans on introducing models that may have different model artifacts depending on the instance type chosen. This will require new metadata, and new SDK code for consuming this metadata.
Testing done:
Unit tests added
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.