-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: use workflow parameters in training hyperparameters (#2114) (#2115) #2227
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
fix: use workflow parameters in training hyperparameters (#2114) (#2115) #2227
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 |
src/sagemaker/workflow/pipeline.py
Outdated
@@ -75,7 +75,7 @@ def to_request(self) -> RequestType: | |||
def create( | |||
self, | |||
role_arn: str, | |||
description: str = None, | |||
pipeline_description: 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.
Any reason to change this beyond aesthetics? It will be a breaking change, and seems like there is precedence for the prior convention.
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.
docstring parameter used is pipeline_description
. I changed it to match it. This is not a breaking change. It passes all unit test
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.
Then the docstring needs to be changed. If someone is passing this with named arguments (pipeline.create(description='My description', ...)
) they will get create() got an unexpected keyword argument 'description'
. The unit tests pass because they're all using positional arguments.
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.
oh right forgot about that. I'll change the docstring
@@ -127,22 +139,26 @@ def test_training_step(sagemaker_session): | |||
"Type": "Training", | |||
"Arguments": { | |||
"AlgorithmSpecification": {"TrainingImage": IMAGE_URI, "TrainingInputMode": "File"}, | |||
"HyperParameters": { | |||
"batch-size": training_batch_size_parameter, |
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 expect to see objects in this assertion. Does it work if asserted on {"Get": "Parameters.TrainingBatchSize"}
?
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.
No that won't work. pipeline.to_request()
won't interpolate parameters like that but pipeline.definition()
would. Here's the code that does that https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/workflow/pipeline.py#L248-L258
We have older unit tests that perform similar assertions https://github.com/aws/sagemaker-python-sdk/blob/master/tests/unit/sagemaker/workflow/test_pipeline.py#L187.
Lmk if you think I should change pipeline.to_request()
logic to return parameter expressions instead of objects.
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.
That's fine, I just wanted to make sure we have coverage on the conversion of those Parameter objects to the JSON code, looks like it's in test_pipeline.py
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 |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…ws#2115) (aws#2227) Co-authored-by: Namrata Madan <[email protected]> Co-authored-by: Ahsan Khan <[email protected]> Co-authored-by: icywang86rui <[email protected]>
Issue #, if available:
** #2114
** #2115
Description of changes:
**Changed Training job hyperparameter parsing logic to use SageMaker Pipeline parameters as is, instead of converting them to strings
** Changed Processing job input source uri parsing logic to ignore SageMaker Pipeline parameters
Testing done:
Edited unit tests to cover pipeline parameters for training and processing 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.