【发布时间】:2019-08-14 19:55:38
【问题描述】:
我通过 Sagemaker Jupyter 笔记本实例中的单独脚本创建了一个端点。我正在尝试在另一个脚本中访问该端点并对其进行推理。
我不知道我可以运行什么来专门拉取端点并将其分配给变量。
过去我部署了一个链接到 RCF 的端点,如下所示:
#This creates an endpoint
rcf_inference = rcf.deploy(
initial_instance_count=1,
instance_type='ml.m4.xlarge',
)
print('Endpoint name: {}'.format(rcf_inference.endpoint))
我在另一个脚本中使用了 rcf_inference 变量来运行推理,我想在这里遵循相同的路线,但无法重新部署 rcf。
#This grabs the data we want to test from an s3
s3=boto3.client('s3')
obj=s3.get_object(Bucket=bucket,Key=testingDataKey)
prediction_data = pandas.read_csv(io.BytesIO(obj['Body'].read()))
prediction_data_numpy=np.array(prediction_data)
#This line runs the test data and stores it in results.
#I do not have a rcf_inference variable, so I can't run it this way though.
#results = rcf_inference.predict(prediction_data_numpy)
predictor = RealTimePredictor(endpoint=endpoint, accept=CONTENT_TYPE_CSV)
results=predictor.predict(prediction_data_numpy.tobytes())
必须有某种方法来调用我的端点并将其分配给这个变量,对吧?我的目标是获取这个变量并对其进行推断,就像我在其他脚本中所做的那样。当我通过当前方法运行它时,我得到“无法评估提供的有效负载”。
【问题讨论】:
标签: python jupyter endpoint amazon-sagemaker inference