如何在Sagemaker上使用脚本模式训练和部署模型,而不使用jupyter笔记本实例(无服务器)?

4

我一直在使用Jupyter Notebook实例来启动训练作业(在另一个实例上),并部署端点(在另一个实例上)。我正在使用Sagemaker Tensorflow API,如下所示:

# create Tensorflow object and provide and entry point script
tf_estimator = TensorFlow(entry_point='tf-train.py', role='SageMakerRole',
                      train_instance_count=1, train_instance_type='ml.p2.xlarge',
                      framework_version='1.12', py_version='py3')

# train model on data on s3 and save model artifacts to s3
tf_estimator.fit('s3://bucket/path/to/training/data')

# deploy model on another instance using checkpoints saved on S3
predictor = estimator.deploy(initial_instance_count=1,
                         instance_type='ml.c5.xlarge',
                         endpoint_type='tensorflow-serving')

我一直通过Jupyter Notebook实例完成所有这些步骤。有哪些AWS服务可以用来摆脱Jupyter Notebook实例的依赖,并以无服务器方式自动化这些任务,进行模型的训练和部署?
1个回答

2
我推荐使用 AWS Step Functions。 我一直在使用它来安排SageMaker Batch Transform和预处理作业,因为它与CloudWatch事件规则集成。 它还可以训练模型,执行hpo调整,并与lambda集成。 还有一个SageMaker / Step Functions SDK,您也可以直接创建状态机使用Step Functions。以下是一些示例和文档:

https://aws.amazon.com/about-aws/whats-new/2019/11/introducing-aws-step-functions-data-science-sdk-amazon-sagemaker/

https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html


这是否仍将在SageMaker上创建/使用/触发模型的端点?还是只使用批处理作业? - wawawa

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接