英文:
how to create a model package in sagemaker pipeline?
问题
根据此文档链接,https://github.com/aws/sagemaker-python-sdk/blob/master/doc/amazon_sagemaker_model_building_pipeline.rst#model-step,我可以链接SageMaker管道步骤(下面是示例代码)。我想知道,如果需要的话,是否可以直接传递模型所在的S3 URI,而不是step_train.properties.ModelArtifacts.S3ModelArtifacts,以便model_data = s3://somebucket/modelfile.tar...
step_train = TrainingStep(...)
model = Model(
image_uri=pytorch_estimator.training_image_uri(),
model_data=step_train.properties.ModelArtifacts.S3ModelArtifacts,
sagemaker_session=pipeline_session,
role=role,
)
# 我们可能还想创建一个SageMaker模型
step_model_create = ModelStep(
name="MyModelCreationStep",
step_args=model.create(instance_type="ml.m5.xlarge"),
)
# 此外,我们可能还想将模型注册到SageMaker模型注册表
register_model_step_args = model.register(
content_types=["*"],
response_types=["application/json"],
inference_instances=["ml.m5.xlarge"],
transform_instances=["ml.m5.xlarge"],
description="MyModelPackage",
)
step_model_registration = ModelStep(
name="MyModelRegistration",
step_args=register_model_step_args,
)
...
英文:
based on the documentation here , https://github.com/aws/sagemaker-python-sdk/blob/master/doc/amazon_sagemaker_model_building_pipeline.rst#model-step, I can chain sagemaker pipeline step (sample code below) . i want to know , if needed, is it possible to pass the s3 uri , where model is located directly , instead of step_train.properties.ModelArtifacts.S3ModelArtifacts, such that model_data = s3://somebucket/modelfile.tar...
step_train = TrainingStep(...)
model = Model(
image_uri=pytorch_estimator.training_image_uri(),
model_data=step_train.properties.ModelArtifacts.S3ModelArtifacts,
sagemaker_session=pipeline_session,
role=role,
)
# we might also want to create a SageMaker Model
step_model_create = ModelStep(
name="MyModelCreationStep",
step_args=model.create(instance_type="ml.m5.xlarge"),
)
# in addition, we might also want to register a model to SageMaker Model Registry
register_model_step_args = model.register(
content_types=["*"],
response_types=["application/json"],
inference_instances=["ml.m5.xlarge"],
transform_instances=["ml.m5.xlarge"],
description="MyModelPackage",
)
step_model_registration = ModelStep(
name="MyModelRegistration",
step_args=register_model_step_args,
)
...
答案1
得分: 1
是的,你可以直接传递URL。
英文:
Yes, you can pass the URL directly.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论