aws / sagemaker-inference-toolkit

Serve machine learning models within a 🐳 Docker container using 🧠 Amazon SageMaker.
Apache License 2.0
385 stars 82 forks source link

Request encoding function for application/jsonlines output format #56

Open BaoshengHeTR opened 4 years ago

BaoshengHeTR commented 4 years ago

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.

ajaykarpur commented 4 years ago

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.

BaoshengHeTR commented 4 years ago

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?

metrizable commented 4 years ago

@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)?

BaoshengHeTR commented 4 years ago

here

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

metrizable commented 4 years ago

@BaoshengHeTR

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

Best regards.