sagemaker-inference-toolkit icon indicating copy to clipboard operation
sagemaker-inference-toolkit copied to clipboard

Request encoding function for application/jsonlines output format

Open BaoshengHeTR opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. When I call encoder.encode(prediction, accept='application/jsonlines') with prediction a list of json, it generates an error. Describe the solution you'd like Hope the returned a output file with json records arranged by lines, i.e.:

{'key': value, ...}
{'key': value, ...}
...

Describe alternatives you've considered If the above request has been solved, please give the document souce. Thanks.

BaoshengHeTR avatar Jun 25 '20 15:06 BaoshengHeTR

When I call encoder.encode(prediction, accept='application/jsonlines') with prediction a list of json, it generates an error.

@BaoshengHeTR, can you please provide the error, stack trace, and any other relevant logs related to this error? Please also provide relevant system information as listed in the bug report issue template.

ajaykarpur avatar Jun 26 '20 18:06 ajaykarpur

When I call encoder.encode(prediction, accept='application/jsonlines') with prediction a list of json, it generates an error.

@BaoshengHeTR, can you please provide the error, stack trace, and any other relevant logs related to this error? Please also provide relevant system information as listed in the bug report issue template.

can you show me an application of inference-tookit using application/lines as output accept output format?

BaoshengHeTR avatar Jun 26 '20 18:06 BaoshengHeTR

@BaoshengHeTR For the inference toolkit, the encoder.encode method here will raise an UnsupportedFormatError if the content_type is not found in the encoder map. The specific string values of the constants in the encoder map can be found here.

Is an UnsupportedFormatError what you are experiencing? Could you provide details regarding the particular error you are facing (as listed in the bug report issue template)?

metrizable avatar Jul 02 '20 05:07 metrizable

here

Thanks. The problem is because my type is application/jsonlines rather than application/json. I managed to solve my problem in another way.

BaoshengHeTR avatar Jul 02 '20 22:07 BaoshengHeTR

@BaoshengHeTR

Thanks again for contacting us. Let us know if there's anything else we can help with.

Best regards.

metrizable avatar Jul 03 '20 01:07 metrizable