为什么AWS SageMaker创建S3存储桶

2024-04-25 09:31:07 发布

您现在位置:Python中文网/ 问答频道 /正文

在python中部署带有boto3客户端的自定义pytorch模型时。我注意到创建了一个新的S3 bucket,其中没有可见的对象。这有什么原因吗

包含我的模型的bucket被命名为包含关键字“sagemaker”,所以我没有任何问题

以下是我用于部署的代码:

remote_model = PyTorchModel(
                     name = model_name, 
                     model_data=model_url,
                     role=role,
                     sagemaker_session = sess,
                     entry_point="inference.py",
                     # image=image, 
                     framework_version="1.5.0",
                     py_version='py3'
                    )

remote_predictor = remote_model.deploy(
                         instance_type='ml.g4dn.xlarge', 
                         initial_instance_count=1,
                         #update_endpoint = True, # comment or False if endpoint doesns't exist
                         endpoint_name=endpoint_name, # define a unique endpoint name; if ommited, Sagemaker will generate it based on used container
                         wait=True
                         )

Tags: instancenamepy模型imagetruemodelif
1条回答
网友
1楼 · 发布于 2024-04-25 09:31:07

它很可能是由SageMaker Python SDK创建的默认bucket。请注意,您编写的代码不是boto3(AWS python SDK),而是sagemakerlink),SageMaker特定的python SDK,它的级别高于boto3

SageMaker Python SDK在多个位置使用S3,例如,在使用框架估计器时准备训练代码,在使用框架模型(您的案例)部署时准备推理代码。它让您可以控制要使用的S3位置,但如果您没有指定它,它可能会使用自动生成的bucket,如果它有这样做的权限的话

要控制代码暂存S3位置,可以在PyTorchEstimator(培训)或PyTorchModel(服务)中使用参数code_location

相关问题 更多 >