I'm using the SageMaker python sdk and was hoping to pass in some arguments to be used by my entrypoint, I'm not seeing how to do this.
from sagemaker.sklearn.estimator import SKLearn # sagemaker python sdk
entrypoint = 'entrypoint_script.py'
sklearn = SKLearn(entry_point=entrypoint, # <-- need to pass args to this
train_instance_type=instance_class,
role=role,
sagemaker_session=sm)
Initialize an EstimatorBase instance. role ( str) – An AWS IAM role (either name or full ARN). The Amazon SageMaker training jobs and APIs that create Amazon SageMaker endpoints use this role to access training data and model artifacts. After the endpoint is created, the inference code might use the IAM role, if it needs to access an AWS resource.
Instance of the calling Estimator Class with the attached training job. Display the logs for Estimator’s training job. If the output is a tty or a Jupyter cell, it will be color-coded based on which instance the log entry is from. Deploy the trained model to an Amazon SageMaker endpoint. And then return sagemaker.Predictor object.
You can assign entry_point=’src/train.py’. Path (absolute, relative or an S3 URI) to a directory with any other training source code dependencies aside from the entry point file (default: None). If source_dir is an S3 URI, it must point to a tar.gz file. Structure within this directory are preserved when training on Amazon SageMaker.
Amazon SageMaker Model Building Pipelines supports the following parameter types: ParameterString – Representing a string parameter. ParameterInteger – Representing an integer parameter. ParameterFloat – Representing a float parameter. ParameterBoolean – Representing a Boolean Python type.
The answer is no as there is no parameter on the Estimator base class, or the fit method, that accepts arguments to pass to the entrypoint.
I resolved this by passing the parameter as part of the hyperparameter dictionary. This gets passed to the entrypoint as arguments.
The entry_point argument here is for a script file that contains the codes you want to run training and prediction.
You can refer to the example here
And the entry_point script above example uses is here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With