Skip to content

Not able to have the value of the output_path in TensorFlow estimator as pipeline parameter #3149

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

Closed
mouhannadali opened this issue May 31, 2022 · 6 comments
Labels
component: pipelines Relates to the SageMaker Pipeline Platform type: bug

Comments

@mouhannadali
Copy link

Describe the bug
I am not able to have the value of the output_path in TensorFlow estimater as pipeline parameter

To reproduce
I created the following Sagemaker workflow parameters:

training_instance_type = ParameterString(name="TrainingInstanceType", default_value="ml.c5.2xlarge")
training_instance_count = ParameterInteger(name="TrainingInstanceCount", default_value=1)
use_spot_instances = ParameterBoolean(name="UseSpot_Instances", default_value=False)
train_output_s3 = ParameterString(name="TrainOutputS3Path", default_value="s3://bucketname/key/")

created the following TF estimator:

estimator = TensorFlow(
    sagemaker_session=sess,
    entry_point="unet.py",
    source_dir="scripts/",
    role=role,
    instance_count=training_instance_count,
    instance_type=training_instance_type,
    framework_version="2.1",
    py_version="py3",
    use_spot_instances=use_spot_instances,
    output_path=train_output_s3,
    container_log_level=logging.WARNING,
    hyperparameters=hyperparameters,
)

created the training step:

input_path = "s3://bucketname-2/key-2/"
inputs = TrainingInput(s3_data=input_path)

step_train = TrainingStep(
    name="pytorch-train",
    estimator=estimator,
    inputs=inputs,
)

and finally created the pipeline and tried to print the pipeline.definition()

pipeline = Pipeline(
    name=pipeline_name,
    parameters = [training_instance_type, training_instance_count,use_spot_instances, train_output_s3],
    steps=[step_train],
    sagemaker_session=sess,
)

pipeline.definition()

Expected behavior
The pipeline should be created without any problem

Screenshots or logs
image

Additional context
Now if I hardcode the output_path in the estimator then it is working correctly:

estimator = TensorFlow(
    sagemaker_session=sess,
    entry_point="unet.py",
    source_dir="scripts/",
    role=role,
    instance_count=training_instance_count,
    instance_type=training_instance_type,
    framework_version="2.1",
    py_version="py3",
    use_spot_instances=use_spot_instances,
    output_path="s3://bucketname/key/",
    container_log_level=logging.WARNING,
    hyperparameters=hyperparameters,
)
@qidewenwhen
Copy link
Member

@mouhannadali thanks for using SageMaker Pipeline!

I'm not able to reproduce the issue based on the code snippets in this issue. Could you please do the following and see if the issue still persists?

Please let us know if you have any questions.

@mouhannadali
Copy link
Author

Hi @qidewenwhen thanks for the replay. I did update the SDK package to sagemaker-2.92.2 and hard coded the training_instance_type. Now I am getting the following error:
image

@qidewenwhen
Copy link
Member

qidewenwhen commented Jun 1, 2022

Thanks @mouhannadali for the quick update!
Yea this is what I saw and we had a related issue reported: #3142

This pending PR should be able to fix it: #3146

@mouhannadali
Copy link
Author

mouhannadali commented Jun 1, 2022

Thanks @qidewenwhen for the fast reply. one more question: is there a notebook/script example (best practice) where it shows how to pass all the parameters of an estimator (Tesorflow estimator) including hyperparameters as training pipeline parameters?

@qidewenwhen
Copy link
Member

Thanks @qidewenwhen for the fast reply. one more question: is there a notebook/script example (best practice) where it shows how to pass all the parameters of an estimator (Tesorflow estimator) including hyperparameters as training pipeline parameters?

We have this sample notebook with Tensorflow estimator: https://github.com/aws/amazon-sagemaker-examples/blob/main/sagemaker-pipelines/tabular/tensorflow2-california-housing-sagemaker-pipelines-deploy-endpoint/tensorflow2-california-housing-sagemaker-pipelines-deploy-endpoint.ipynb

@mouhannadali
Copy link
Author

It is working now after updating to the last SDK version. Thanks for the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pipelines Relates to the SageMaker Pipeline Platform type: bug
Projects
None yet
Development

No branches or pull requests

3 participants