python - 直接从模型工件进行部署
问题描述
我想在 Sagemaker 部署一个预训练的神经网络作为端点。我所有的模型工件都存储在 S3 中。
在 Sagemacer 文档(此处)中,我找到了此解决方案:
from sagemaker.tensorflow import TensorFlowModel
model = TensorFlowModel(model_data='s3://mybucket/model.tar.gz', role='MySageMakerRole')
predictor = model.deploy(initial_instance_count=1, instance_type='ml.c5.xlarge')
我像这样调整了 TensorFlowModel() 函数:
from sagemaker.tensorflow import TensorFlowModel
from sagemaker import get_execution_role
role = get_execution_role()
tensorflow_model = TensorFlowModel(model_data='s3://my-bucket-name/path_to_the_model/model.tar.gz',
role=role,
framework_version='2.1.0')
这导致了错误:TypeError: init () missing 1 required positional argument: 'entry_point'
sagemaker.tensorflow.model.TensorFlowModel() (此处)的文档说明了参数入口点:
entry_point (str) – Python 源文件的路径(绝对或相对),应作为模型托管的入口点执行。如果指定了 source_dir,则 entry_point 必须指向位于 source_dir 根目录的文件。
文档是错误的还是我遗漏了我的代码和文档中的示例之间的主要区别?