所以我有一个预训练的 ML 模型存储在 S3 存储桶中(名称
example.tar.gz
),我有一个管道,它将运行 terraform 通过在 SageMaker 上使用此文件来创建模型并获得预测,我的问题是什么SageMaker 上创建的模型版本控制的最佳实践?
我的想法是我手动将此模型工件设置为
example-v1.tar.gz
之类的名称,这意味着这是我们将部署的第一个工件,然后因为我的管道可以对terraform代码进行版本控制(构建一个terraform-v1.0.0.zip
文件),然后执行此文件以在 SageMaker 上创建模型,我的问题基本上是我应该在 SageMaker 上使用 model-v1
作为模型名称,还是应该经常更新此模型名称,就像每次有新版本的 terraform zip 文件时,我们使用相同的版本号SageMaker 上的模型名称 (model-v1.0.0
)?
我是机器学习模型部署的新手,对此有点困惑,希望这是有道理的,有人可以帮助我吗?谢谢。
您可以使用 Sagemaker Model Registry 注册您的模型和版本控制:aws doc
使用示例:
# Specify the model source
model_url = "s3://your-bucket-name/model.tar.gz"
modelpackage_inference_specification = {
"InferenceSpecification": {
"Containers": [
{
"Image": '257758044811.dkr.ecr.us-east-2.amazonaws.com/sagemaker-xgboost:1.2-1',
"ModelDataUrl": model_url
}
],
"SupportedContentTypes": [ "text/csv" ],
"SupportedResponseMIMETypes": [ "text/csv" ],
}
}
# Alternatively, you can specify the model source like this:
# modelpackage_inference_specification["InferenceSpecification"]["Containers"][0]["ModelDataUrl"]=model_url
create_model_package_input_dict = {
"ModelPackageGroupName" : model_package_group_name,
"ModelPackageDescription" : "Model to detect 3 different types of irises (Setosa, Versicolour, and Virginica)",
"ModelApprovalStatus" : "PendingManualApproval"
}
create_model_package_input_dict.update(modelpackage_inference_specification)