python中maker_python - AWS SageMaker PyTorch:没有名为'sagemaker'的模块_python_酷徒编程知识库...

在尝试使用Python进行AWS SageMaker PyTorch预测时,遇到了'No module named 'sagemaker''的错误。问题出现在调用`PyTorchPredictor`并尝试预测时,由于缺少sagemaker模块导致服务端返回了500错误。为了解决这个问题,需要检查环境是否正确安装了sagemaker库,并确保该库在运行的环境中可用。
摘要由CSDN通过智能技术生成

代碼:import numpy as np

from sagemaker.pytorch.model import PyTorchPredictor

ENDPOINT = ''

predictor = PyTorchPredictor(ENDPOINT)

predictor.predict(np.random.random_sample([1, 3, 224, 224]).tobytes())

詳細錯誤消息:Traceback (most recent call last):

File"client.py", line 7, in

predictor.predict(np.random.random_sample([1, 3, 224, 224]).tobytes())

File"/Users/jiashenc/Env/py3/lib/python3.7/site-packages/sagemaker/predictor.py", line 110, in predict

response = self.sagemaker_session.sagemaker_runtime_client.invoke_endpoint(**request_args)

File"/Users/jiashenc/Env/py3/lib/python3.7/site-packages/botocore/client.py", line 276, in _api_call

return self._make_api_call(operation_name, kwargs)

File"/Users/jiashenc/Env/py3/lib/python3.7/site-packages/botocore/client.py", line 586, in _make_api_call

raise error_class(parsed_response, operation_name)

botocore.errorfactory.ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received server error (500) from model with message"No module named 'sagemaker'". See https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#logEventViewer:group=/aws/sagemaker/Endpoints/ in account xxxxxxxxxxxxxx for more information.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值