Skip to content
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: pass code_location to create_model for tensorflow estimator deployment #4537

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

HCharlie
Copy link

@HCharlie HCharlie commented Mar 25, 2024

#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

  • I have read the CONTRIBUTING doc
  • 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
  • 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.

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.44%. Comparing base (0075fb3) to head (07d3f9e).

❗ 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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HCharlie HCharlie changed the title MLX-1224 pass code_location to create_model for tensorflow estimator deployment fix: pass code_location to create_model for tensorflow estimator deployment May 2, 2024
@HCharlie
Copy link
Author

HCharlie commented May 2, 2024

Hi @mohanasudhan, do you know what's missing for this PR?

@mohanasudhan
Copy link
Contributor

Can you explain your usecase and add unit/integ test?

@HCharlie
Copy link
Author

HCharlie commented May 2, 2024

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. #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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants