我已经在AWS中部署了管道模型,现在正在尝试使用ModelMonitor来评估传入的数据行为,但是当生成监视报告时它失败了
管道由一个预处理步骤和一个常规的XGBoost容器组成。模型是用Content-type: application/json调用的。
为此,我按照文档中所述进行了设置,但由于以下错误而失败
线程“主”com.amazonaws.sagemaker.dataanalyzer.exception.CustomerError:错误中的异常:编码不匹配:编码是endpointInput的JSON,而endpointOutput的编码是CSV。我们目前只支持相同类型的输入和输出编码。
我在问题 GitHub找到了这个,但没有帮到我。
深入了解XGBoost输出的方式,我发现它是CSV编码的,因此错误是有意义的,但是即使部署强制序列化器的模型也会失败(下面一节中的代码)
我正在按照AWS的建议配置时间表,我刚刚更改了约束的位置(必须手动调整)
data_capture_config=DataCaptureConfig(
enable_capture = True,
sampling_percentage=100,
json_content_types = ['application/json'],
destination_s3_uri=MY_BUCKET)predictor = Predictor(
endpoint_name=MY_ENDPOINT,
# Hoping that I could force the output to be a JSON
deserializer=sagemaker.deserializers.JSONDeserializer) 以及以后的
predictor = Predictor(
endpoint_name=MY_ENDPOINT,
# Hoping that I could force the input to be a CSV
serializer=sagemaker.serializers.CSVSerializer) p_modle = pipeline_model.deploy(
initial_instance_count=1,
instance_type='ml.m4.xlarge',
endpoint_name=MY_ENDPOINT,
serializer = sagemaker.serializers.JSONSerializer(),
deserializer= sagemaker.deserializers.JSONDeserializer(),
wait = True)发布于 2021-09-17 06:36:39
在前面使用boto3 sagemaker运行时调用端点时,我遇到了一个类似的问题。尝试在invoke_endpoint函数中添加“Accept”参数,其值为“application/json”。
有关更多帮助,请参阅RequestSyntax
https://stackoverflow.com/questions/65836468
复制相似问题