sagemaker-python-sdk
sagemaker-python-sdk copied to clipboard
fix: pass code_location to create_model for tensorflow estimator deployment
https://github.com/aws/sagemaker-python-sdk/issues/4536
Description of changes:
add code_location
which is passed to tensorflow estimator object but not passed to model in the deploy function.
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
- [x] I have read the CONTRIBUTING doc
- [x] I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the Python SDK team
- [x] I used the commit message format described in CONTRIBUTING
- [ ] I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
- [ ] I have updated any necessary documentation, including READMEs and API docs (if appropriate)
Tests
- [ ] I have added tests that prove my fix is effective or that my feature works (if appropriate)
- [ ] I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
- [ ] I have checked that my tests are not configured for a specific region or account (if appropriate)
- [ ] I have used
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.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 87.44%. Comparing base (
0075fb3
) to head (07d3f9e
).
:exclamation: Current head 07d3f9e differs from pull request most recent head eb186cc. Consider uploading reports for the commit eb186cc to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #4537 +/- ##
==========================================
- Coverage 87.49% 87.44% -0.06%
==========================================
Files 391 389 -2
Lines 37254 36889 -365
==========================================
- Hits 32595 32256 -339
+ Misses 4659 4633 -26
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @mohanasudhan, do you know what's missing for this PR?
Can you explain your usecase and add unit/integ test?
Can you explain your usecase and add unit/integ test?
hi @mohanasudhan, thanks for the reply, I think it's either a bug or I am wrong on how to use the tensorflow estimator. I am using Tensorflow estimator, and pass code_location
parameter to the estimator like below, and when the code reaches the esitmator.deploy function, it's not parsing the specified parameter code_location to get the s3 bucket, but trying to create a new default s3 bucket. A more detailed version is specifed here. https://github.com/aws/sagemaker-python-sdk/issues/4536
from sagemaker.tensorflow import TensorFlow
source_dir = 's3://{}/{}/source'.format(bucket, prefix)
output_path = 's3://{}/{}/output'.format(bucket, prefix)
hyperparams = {
'sagemaker_requirements': 'code/requirements.txt'
}
mnist_estimator = TensorFlow(entry_point='code/mnist.py',
base_job_name=base_job_name,
output_path=output_path,
code_location=source_dir,
hyperparameters=hyperparams,
role=role,
instance_count=2,
instance_type='ml.m5.large',
framework_version='2.1.0',
py_version='py3',
distribution={'parameter_server': {'enabled': True}})
## fit
print("start fitting")
mnist_estimator.fit(training_data_uri)
## deploy
print("start deploy")
predictor = mnist_estimator.deploy(initial_instance_count=1, instance_type='ml.m5.large')