我可以用TensorFlow容器训练我的模型。
下面是代码:
model_dir = '/opt/ml/model'
train_instance_type = 'ml.c4.xlarge'
hyperparameters = {'epochs': 10, 'batch_size': 256, 'learning_rate': 0.001}
script_mode_estimator = TensorFlow(
entry_point='model.py',
train_instance_type=train_instance_type,
train_instance_count=1,
model_dir=model_dir,
hyperparameters=hyperparameters,
role=sagemaker.get_execution_role(),
base_job_name='tf-fashion-mnist',
framework_version='1.12.0',
py_version='py3',
output_path='s3://my_bucket/testing',
script_mode=True
)模型拟合:
script_mode_estimator.fit(inputs),但是当我试图部署模型时,我会得到以下错误:
部署代码是:
script_mode_d=script_mode_estimator.deploy(initial_instance_count=1,
instance_type="ml.m4.xlarge")错误是:
UnexpectedStatusException:错误托管端点tf-时尚-mnist-2020-09-23-09-05-25-791:失败。原因:角色“xyz”不具有图像的BatchGetImage权限:BatchGetImage
请帮我解决这个问题.
发布于 2020-09-24 06:44:49
'520713654638.dkr.ecr.us-east-1.amazonaws.com/sagemaker-tensorflow-serving:1.12-cpu'.原因:角色'xyz‘不具有图像的BatchGetImage权限:
此错误意味着IAM角色"xyz“(您可以在IAM中找到它)没有权限在ECR (弹性容器注册表,您可以在BatchGetImage控制台中找到此服务)中进行API调用。
您可以找到许多示例IAM策略,您可以使用"xyz“角色授予它执行API调用她:https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policy-examples.html的权限。
若要将策略添加到IAM控制台,请查找"xyz“角色,或者添加(内联)策略,或者编辑其现有策略之一(如果它已经具有授予类似权限的策略,则在该策略中添加此权限将是合理的)。
发布于 2021-02-08 23:57:26
您可以使用AWS管理的AmazonSageMakerFullAccess权限策略,而不是通过精心设计权限策略来管理权限,该策略允许在SageMaker (包括BatchGetImage)中执行任何可能要执行的操作。
为此:
在控制台上创建一个与sagemaker.amazonaws.com
AmazonSageMakerFullAccess
AmazonS3FullAccess)服务链接的角色,
https://stackoverflow.com/questions/64039980
复制相似问题