-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for BYTES / string tensor types #8
Comments
Hey @njhill , This was quite confusing for me as well when doing it for MLServer. That was until I noticed that, in protobuf, the input = {
"datatype": "BYTES",
"data": [b"foo", b"asdasdasd"],
"shape": [2]
} Not sure if that may make it more confusing though - happy to clarify if you've got any questions! |
Thanks @adriangonz! yes I'd also noticed that more recently. Along with I think the problem still applies to the |
Good point @njhill. We've recently added support for those in MLServer. What we found is that Triton packs You can see this implemented in MLServer in the https://github.com/SeldonIO/MLServer/blob/f0748c7a14e4476f75b6154099247dc2c9b6d43b/mlserver/raw.py#L39-L55 |
Thanks @adriangonz! I wasn't aware of that. |
Addresses #8 Current limitations: - Does not obey request-level content_type request parameters (has to be set at tensor level) - Always encodes response tensor bytes as base64 Signed-off-by: Nick Hill <[email protected]>
Addresses #8 Current limitations: - Does not obey request-level content_type request parameters (has to be set at tensor level) - Always encodes response tensor bytes as base64 Signed-off-by: Nick Hill <[email protected]>
Addresses #8 Current limitations: - Does not obey request-level content_type request parameters (has to be set at tensor level) - Always encodes response tensor bytes as base64 Signed-off-by: Nick Hill <[email protected]>
Now addressed via #17 with the following limitations:
|
Hi @njhill , this is something we are confusing when comparing with the REST API in MLServer and the v2 spec, thanks for the fix. want to confirm that with the above fix, the input accepts raw string but the output response will still be base64 encoded? for example: curl -i -X POST -H "Content-Type: application/json" "http://localhost:8008/v2/models/${MODEL_NAME}/infer" -d '{"inputs": [{ "name": "text", "shape": [2], "datatype": "BYTES", "data": ["I loved this food, it was very good", "I don't loved this food, it was not good"] }] }'
{"model_name":"custom-predictor__ksp-89efd40320","model_version":"v0.1.0","outputs":[{"name":"predictions","datatype":"BYTES","shape":[2],"parameters":{"content_type":{"ParameterChoice":{"StringParam":"str"}}},"data":["Y29tcGxpbWVudA==","Y29tcGxhaW50"]}]}% # rather than ["compliment","complaint"] and when will a new version of |
@lizzzcai yes that's exactly right. Just a small thing in your example though - the value of the returned |
Thanks @njhill for your reply. We have tested the latest release and it works as expected. However, for the output response, will |
@lizzzcai we can open a new issue for it to replace this one :) A complication is knowing when to encode as utf8 vs base64 because you can't encode arbitrary bytes as utf8. We could detect whether the bytes are valid utf8 but this would incur a performance overhead (espec. for non-text data cases).
We are in the process of doing a 0.10.0 release of all the KServe components right now. |
For
BYTES
I think the spec is currently ambiguous (to me at least). For example if strings are used then how should the encoding be determined. Also it's not clear how the byte lengths should be encoded when flattening. One option is to say that they must all be the same length and add a dimension to the shape for this. If their lengths can vary however then something extra is needed, like a corresponding integer tensor to hold them.We can look at MLServer's BYTES string tests and base64 tests for reference.
The text was updated successfully, but these errors were encountered: