-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feature: Allow custom output for RepackModelStep #2804
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
…ries (aws#2755) Co-authored-by: Payton Staub <[email protected]> Co-authored-by: Ahsan Khan <[email protected]>
Co-authored-by: Shreya Pandit <[email protected]>
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 |
abc7cd5
to
7087c5a
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
7087c5a
to
4643394
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@staubhp I finished this proposal. |
Looks good to me, thanks for the contribution. Would you mind adding unit tests for RegisterModel & EstimatorTransformer step here just to confirm the repack_path is being wired through to _RepackModelStep? |
f5b4263
to
3a2491d
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 |
While writing the unit test for EstimatorTransformer with repack model and a custom output output_path, I discovered that sending an entry_point to EstimatorTransformer was raising an "unexpected keyword argument 'entry_point'" on Model.__init__. Using code from RegisterModel as a base, I removed the entry_point and other repack variables from kwargs. Also implemented unit tests for this case.
3a2491d
to
faf4ad5
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 |
hey @staubhp, it was a great suggestion to add unit tests for RegisterModel & EstimatorTransformer. I eventually discovered an issue with the So I split the new changes in two commits:
Please let me know what you think. Thanks for reviewing! |
Codecov Report
@@ Coverage Diff @@
## dev #2804 +/- ##
==========================================
- Coverage 89.82% 88.67% -1.15%
==========================================
Files 196 173 -23
Lines 16564 15423 -1141
==========================================
- Hits 14878 13677 -1201
- Misses 1686 1746 +60
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 |
f5e6849
to
34b07c0
Compare
96c01d7
to
c437191
Compare
repack_model = True | ||
entry_point = kwargs.pop("entry_point", None) | ||
source_dir = kwargs.pop("source_dir", None) | ||
dependencies = kwargs.pop("dependencies", 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.
dependencies = kwargs.pop("dependencies", None) | |
dependencies = kwargs.pop("dependencies", None) | |
code_location = kwargs.pop("code_location", 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.
https://github.com/aws/sagemaker-python-sdk/pull/2804/files#diff-043e8c79b0b9ccd41f8164a29ccc1f9e67f38e349aafffb96cd91762c3824bc7R364 (step_collections.py
L364)
I suggest changing this to image_uri=image_uri
. Using training_image_uri() for inference doesn't actually work.
repack_model_step = _RepackModelStep( | ||
name=f"{name}RepackModel", | ||
depends_on=depends_on, | ||
retry_policies=repack_model_step_retry_policies, | ||
sagemaker_session=estimator.sagemaker_session, | ||
role=estimator.sagemaker_session, | ||
role=estimator.role, | ||
model_data=model_data, | ||
entry_point=entry_point, | ||
source_dir=source_dir, |
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.
source_dir=source_dir, | |
source_dir=source_dir, | |
code_location=code_location, |
@@ -336,6 +349,8 @@ def __init__( | |||
security_group_ids=estimator.security_group_ids, | |||
description=description, | |||
display_name=display_name, | |||
repack_output_path=repack_output_path, |
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 you add a repack_image_uri
argument? My customer is facing an issue where the python version SKLearn
(3.7) estimator is different from the training image uri. That caused dependency errors when trying to install packages that are available on (for example) Python 3.8. Another option would be equating it to estimator.training_image_uri()
.
repack_output_path=repack_output_path, | |
repack_output_path=repack_output_path, | |
image_uri=estimator.training_image_uri(), |
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 |
Update: this recently released commit has made the repack step output path align with model repack path. In other words, users can use the Thus, we can close this PR. |
Agree. Superseded by #3257. |
Issue #, if available:
#2803
Description of changes:
As proposed in #2803:
repack_output_path
(defaultNone
) toworkflow.step_collections.RegisterModel
,workflow.step_collections.EstimatorTransformer
andworkflow._utils._RepackModelStep
._RepackModelStep()
calls, handoverrepack_output_path=repack_output_path
received from publicRegisterModel()
andEstimatorTransformer()
_RepackModelStep
, sendoutput_path=repack_output_path
andcode_location=repack_output_path
to the internalSKLearn()
call.Testing done:
Tested RegisterModel without
repack_output_path
(current behavior):Current behaviour stayed the same on the generated pipeline:
Tested RegisterModel with
repack_output_path
:New output on RepackModel step:
Added unit test
tests/unit/sagemaker/workflow/test_utils.py::test_repack_model_step_with_output_path
.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.