-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feature: Adding Jumpstart retrieval functions #2789
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
feature: Adding Jumpstart retrieval functions #2789
Conversation
Codecov Report
@@ Coverage Diff @@
## master-jumpstart #2789 +/- ##
====================================================
+ Coverage 88.76% 88.90% +0.13%
====================================================
Files 179 181 +2
Lines 15734 15855 +121
====================================================
+ Hits 13967 14096 +129
+ Misses 1767 1759 -8
Continue to review full report at Codecov.
|
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 |
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.
suggestion 1: you are running all the unit tests in us-west-2
. Since you are testing all frameworks, you could also vary the regions to ensure the bucket mapping is correct.
suggestion 2: it is important to unit test the retrieve
image URI utility for all frameworks because of the framework-specific subtleties, but I don't think it's necessary for the script
and model_artifact
utilities. For these two utils, maybe it's enough to test one framework and reduce the size of the PR. WDYT?
src/sagemaker/jumpstart/accessors.py
Outdated
class SageMakerSettings(object): | ||
"""Static class for storing the SageMaker settings.""" | ||
|
||
_PARSED_SAGEMAKER_VERSION = "" |
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.
non-blocking: technically, this static attribute isn't a constant, so lower case might be more appropriate.
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.
A few clean-up comments, otherwise LGTM
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
src/sagemaker/jumpstart/accessors.py
Outdated
if JumpStartModelsCache._cache is None or region != JumpStartModelsCache._curr_region: | ||
JumpStartModelsCache._cache = cache.JumpStartModelsCache(region=region, **cache_kwargs) | ||
JumpStartModelsCache._curr_region = region |
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: @evakravi This section is same as lines 80-82 above, can we refactor this to avoid duplicacy?
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 |
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 |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue #, if available:
Description of changes:
This PR implements retrieval functions for JumpStart model specs, allowing training jobs and inference endpoints to be launched with pre-trained models in script mode. More specifically, this PR modifies
sagemaker.model_uris.retrieve
function so that container images compatible with the requested JumpStrart version, model ids, and script (training or inference) can be used. In addition, this PR adds functionssagemaker.script_uris.retrieve
andsagemaker.model_uris.retrieve
to allow users to retrieve s3 uris for model scripts and tarballs (respectively).These utility functions rely on the the JumpStart model cache implemented in #2756, with an additional utility developed in this cache
sagemaker.jumpstart.accessors
to create a singleton for the model cache.This PR also removes the
semantic-version
library from the package dependencies. To deal with versions, JumpStart will instead usepackaging.versions
module.Testing done:
This PR includes unit tests for the retrieve functions, verifying that given a mocked spec file, the functions return the expected value. In addition, integration tests were written that check that the actual retrieve functions, using live jumpstart-hosted content, can successfully launch sagemaker inference and training jobs.
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.