L Xandor
L Xandor

Reputation: 1841

SageMaker custom model output path for tensorflow when creating from s3 artifacts

I'm running the following code to create an endpoint with a preexisting model:

from sagemaker.tensorflow import serving
sagemaker_session = sagemaker.Session()
clf_sm_model = serving.Model(model_data='s3://mybucket/mytrainedmodel/model.tar.gz',
                                     entry_point="inference.py",
                                     source_dir="inf_source_dir",
                                     role=get_execution_role(),
                                     framework_version='1.14',
                                     sagemaker_session=sagemaker_session)

However this create a copy of the model into the default sagemaker bucket. How can I pass a custom path? I've tried model_dir, and output_path but neither are accepted as parameters

Upvotes: 0

Views: 679

Answers (1)

Marc Karp
Marc Karp

Reputation: 1314

The SageMaker Python SDK repackages your model to include your entry_point and source_dir files and uploads this "new" tar ball to the SageMaker default bucket.

You can change this behavior by setting the default_bucket in your sagemaker_session as follows:

sagemaker_session = sagemaker.Session(default_bucket="<mybucket>")

clf_sm_model = serving.Model(model_data='s3://mybucket/mytrainedmodel/model.tar.gz',         
                    .
                    .
                    sagemaker_session=sagemaker_session)
                    .
                    )

Upvotes: 4

Related Questions