【发布时间】:2018-10-04 19:06:03
【问题描述】:
我正在尝试通过 github 示例将我自己的病态学习机器学习模型与 SageMaker 一起使用。
python代码如下:
# Define IAM role import boto3
import re
import os
import numpy as np
import pandas as pd
from sagemaker import get_execution_role
import sagemaker as sage from time
import gmtime, strftime
role = get_execution_role()
ess = sage.Session()
account = sess.boto_session.client('sts').get_caller_identity()['Account']
region = sess.boto_session.region_name
image = '{}.dkr.ecr.{}.amazonaws.com/decision-trees-sample:latest'.format(account, region)
output_path="s3://output"
sess
tree = sage.estimator.Estimator(image,
role, 1, 'ml.c4.2xlarge',
output_path='s3-eu-west-1.amazonaws.com/output',
sagemaker_session=sess)
tree.fit("s3://output/iris.csv")
但我收到此错误:
INFO:sagemaker:使用名称创建培训作业: 决策树样本-2018-04-24-13-13-38-281
----------------------------------- ---------------------------- ClientError Traceback(最近调用 最后)在() 14 sagemaker_session=sess) 15 ---> 16 tree.fit("s3://inteldatastore-cyrine/iris.csv")
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/estimator.py 适合(自我,输入,等待,日志,job_name) 161 self.output_path = 's3://{}/'.format(self.sagemaker_session.default_bucket()) 162 --> 163 self.latest_training_job = _TrainingJob.start_new(自我,输入) 164 如果等待: 165 self.latest_training_job.wait(logs=logs)
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/estimator.py 在 start_new(cls,估计器,输入) 第336章 job_name=estimator._current_job_name, 第337章 --> 338 超参数=超参数,stop_condition=stop_condition) 339 340 返回 cls(estimator.sagemaker_session, estimator._current_job_name)
~/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/session.py 在火车(自我,图像,输入模式,输入配置,角色,工作名称, output_config、resource_config、超参数、stop_condition) 242 LOGGER.info('使用名称创建训练作业:{}'.format(job_name)) 243 LOGGER.debug('train request: {}'.format(json.dumps(train_request, indent=4))) --> 244 self.sagemaker_client.create_training_job(**train_request) 245 246 def create_model(self, name, role, primary_container):
~/anaconda3/envs/python3/lib/python3.6/site-packages/botocore/client.py 在 _api_call(self, *args, **kwargs) " 312 "%s() 只接受关键字参数。" % py_operation_name) 313 # 这个范围内的“self”是指BaseClient。 --> 314 返回 self._make_api_call(operation_name, kwargs) 315 第316章
~/anaconda3/envs/python3/lib/python3.6/site-packages/botocore/client.py 在 _make_api_call(self, operation_name, api_params) 610 error_code = parsed_response.get("错误", {}).get("代码") 611 error_class= self.exceptions.from_code(error_code) --> 612 引发 error_class(parsed_response, operation_name) 613 其他: 第614章
ClientError:调用时发生错误(AccessDeniedException) CreateTrainingJob 操作: 用户: arn:aws:sts::307504647302:assumed-role/default/SageMaker 是 无权执行:sagemaker:CreateTrainingJob 资源: arn:aws:sagemaker:eu-west-1:307504647302:training-job/decision-trees-sample-2018-04-24-13-13-38-281
你能帮我解决这个问题吗?
谢谢
【问题讨论】:
-
您尝试了哪些尝试来解决该错误?
标签: amazon-sagemaker