Отправить список строк на AWS Sagemaker Endpoint - PullRequest
0 голосов
/ 19 февраля 2020

Я пытаюсь отправить список строк на AWS конечную точку sagemaker, ожидаются байты, байты или типы файлов. Я попробовал пару вариантов, до сих пор не смог дозвониться, может кто-нибудь помочь. Вот код для справки

data = ['Today is  very good day',
             'Today is bad day',
             'Future is great',
            'Great days all days of my life',
            'total disaster',
            'life definitely not good']
response = client.invoke_endpoint(
    EndpointName='enpoint_name', 
    CustomAttributes=custom_attributes,
    ContentType='application/x-npy' ,
    Body=data
    )

И ошибка, которую я получил,

---------------------------------------------------------------------------
ParamValidationError                      Traceback (most recent call last)
<ipython-input-121-183cac745d9e> in <module>()
      3     CustomAttributes=custom_attributes,
      4     ContentType='application/x-npy' ,
----> 5     Body=data
      6     )

3 frames
/usr/local/lib/python3.6/dist-packages/botocore/validate.py in serialize_to_request(self, parameters, operation_model)
    295                                                     operation_model.input_shape)
    296             if report.has_errors():
--> 297                 raise ParamValidationError(report=report.generate_report())
    298         return self._serializer.serialize_to_request(parameters,
    299                                                      operation_model)

ParamValidationError: Parameter validation failed:
Invalid type for parameter Body, value: ['Today is  very good day', 'Today is bad day', 'Future is great', 'Great days all days of my life', 'total disaster', 'life definitely not good'], type: <class 'list'>, valid types: <class 'bytes'>, <class 'bytearray'>, file-like object

Может помочь.

...