Amazon SageMaker
Executing individual steps in SageMaker.
Last updated
Was this helpful?
Executing individual steps in SageMaker.
Last updated
Was this helpful?
offers specialized compute instances to run your training jobs and has a comprehensive UI to track and manage your models and logs. ZenML's SageMaker step operator allows you to submit individual steps to be run on Sagemaker compute instances.
You should use the SageMaker step operator if:
one or more steps of your pipeline require computing resources (CPU, GPU, memory) that are not provided by your orchestrator.
you have access to SageMaker. If you're using a different cloud provider, take a look at the or step operators.
Create a role in the IAM console that you want the jobs running in SageMaker to assume. This role should at least have the AmazonS3FullAccess
and AmazonSageMakerFullAccess
policies applied. Check for a guide on how to set up this role.
To use the SageMaker step operator, we need:
The ZenML aws
integration installed. If you haven't done so, run
installed and running.
An IAM role with the correct permissions. See the for detailed instructions.
An as part of our stack. Take a look for a guide on how to set that up.
A as part of your stack. This is needed so that both your orchestration environment and SageMaker can read and write step artifacts. Check out the documentation page of the artifact store you want to use for more information on how to set that up and configure authentication for it.
An instance type that we want to execute our steps on. See for a list of available instance types.
(Optional) An experiment that is used to group SageMaker runs. Check to see how to create an experiment.
There are two ways you can authenticate your orchestrator to AWS to be able to run steps on SageMaker:
Once you added the step operator to your active stack, you can use it to execute individual steps of your pipeline by specifying it in the @step
decorator as follows:
The recommended way to authenticate your SageMaker step operator is by registering or using an existing and connecting it to your SageMaker step operator. The credentials configured for the connector must have permissions to create and manage SageMaker runs (e.g. permissions). The SageMaker step operator uses these aws-generic
resource type, so make sure to configure the connector accordingly:
If using a : ZenML will try to implicitly authenticate to AWS via the default
profile in your local . Make sure this profile has permissions to create and manage SageMaker runs (e.g. permissions).
ZenML will build a Docker image called <CONTAINER_REGISTRY_URI>/zenml:<PIPELINE_NAME>
which includes your code and use it to run your steps in SageMaker. Check out if you want to learn more about how ZenML builds these images and how you can customize them.
For additional configuration of the SageMaker step operator, you can pass SagemakerStepOperatorSettings
when defining or running your pipeline. Check out the for a full list of available attributes and for more information on how to specify settings.
For more information and a full list of configurable attributes of the SageMaker step operator, check out the .
Note that if you wish to use this step operator to run steps on a GPU, you will need to follow to ensure that it works. It requires adding some extra settings customization and is essential to enable CUDA for the GPU to give its full acceleration.