SageMaker SkLearn - model is saving to the provided bucket, and not the complete provided path

Viewed 296

I am very new to SageMaker, and I am following the SkLearn example from this link:

https://github.com/aws/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/scikit_learn_inference_pipeline/Inference%20Pipeline%20with%20Scikit-learn%20and%20Linear%20Learner.ipynb

I wanted to save my model in a specified S3, hence, I updated the estimator code as follow:

from sagemaker.sklearn.estimator import SKLearn

FRAMEWORK_VERSION = "0.23-1"
script_path = "sklearn_abalone_featurizer.py"

sklearn_preprocessor = SKLearn(
    entry_point=script_path,
    role=role,
    framework_version=FRAMEWORK_VERSION,
    instance_type="ml.c4.xlarge",
    sagemaker_session=sagemaker_session,
    output_path = "s3://aws-prod01-sandbox/sklearnModel/model/"
)

However, the model is being saved to s3//aws-prod01-sandbox/sagemaker-scikit-learn-2021-07-08/source/sourcedir.tar.gz instead. It is not taking the key that I have provided in the estimator.

Any help would be appreciated.

Thank you!

**I found the solution to this problem. Just in case anyone has the same issue, update the estimator as follow:

sklearn_preprocessor = SKLearn(
    entry_point=script_path,
    role=role,
    framework_version=FRAMEWORK_VERSION,
    instance_type="ml.c4.xlarge",
    sagemaker_session=sagemaker_session,
    output_path = "s3://aws-prod01-sandbox/sklearnModel/model/",
    code_location = "s3://aws-prod01-sandbox/sklearnModel/model/"
)
0 Answers
Related