-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: account for EI and version-based ECR repo naming in serving_image_uri() #1273
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
Conversation
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 |
self.py_version, | ||
accelerator_type=accelerator_type, | ||
deploy_image = self.serving_image_uri( | ||
region_name, instance_type, accelerator_type=accelerator_type |
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.
[Minor] Keyword/Named arguments make kittens happy.
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.
talked offline - I don't see a significant benefit of doing region_name=region_name
over region_name
"""Create a URI for the serving image. | ||
|
||
Args: | ||
region_name (str): AWS region where the image is uploaded. | ||
instance_type (str): SageMaker instance type. Used to determine device type | ||
(cpu/gpu/family-specific optimized). | ||
accelerator_type (str): The Elastic Inference accelerator type to | ||
deploy to the instance for loading and making inferences to the | ||
model. Currently unsupported with PyTorch. |
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 as above. What happens if this is passed in? Is the img not found?
src/sagemaker/mxnet/model.py
Outdated
return fw_utils.create_image_uri( | ||
framework_name = self.__framework_name__ | ||
if self._is_mms_version(): | ||
framework_name += "-serving" |
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.
String join is more efficient than string concatenation. For more details, see:
- https://stackoverflow.com/questions/3055477/how-slow-is-pythons-string-concatenation-vs-str-join
- https://waymoot.org/home/python_string/
framework_name += "-serving" | |
framework_name = "-".join([framework_name, "serving"]) |
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.
talked offline - we'll go with format strings as a compromise between performance and readability, since the performance gain is negligible in this case
an aside - fwiw, a tuple would be more efficient than a list because it's immutable
src/sagemaker/pytorch/model.py
Outdated
return fw_utils.create_image_uri( | ||
framework_name = self.__framework_name__ | ||
if self._is_mms_version(): | ||
framework_name += "-serving" |
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.
String join is more efficient than string concatenation. For more details, see:
- https://stackoverflow.com/questions/3055477/how-slow-is-pythons-string-concatenation-vs-str-join
- https://waymoot.org/home/python_string/
framework_name += "-serving" | |
framework_name = "-".join([framework_name, "serving"]) |
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:
serving_image_uri()
method that was originally added in fix: Use serving_image_uri for Airflow #1245 didn't originally have an option for EI because we don't have parity for Airflow yet, but there was the opportunity to remove duplicated code by reusing the new method in each model class, so I added the accelerator option for that.Testing done:
tox -e pylint,flake8,black-format
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.