-
Notifications
You must be signed in to change notification settings - Fork 178
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
Convert numpy.float32 output values to float #656
Comments
For reference: |
Hey @ryanpmccaffrey, Thanks for raising this one. MLServer supports the use of content types which let you describe how should MLServer treat each input and output. This is how, for instance, MLServer can encode back multiple response types on the MLflow runtime. However, it seems like the HuggingFace runtime forces every response back to be a JSON-encoded string. We'll have a look into this to make the HF runtime more flexible (i.e. similar to how the MLServer-MLflow runtime behaves). |
@adriangonz I have also recently seen a similar error when trying to create a custom runtime that might include numpy int types. e.g.
The key line is the use of output[0] from scikit-learn this variable is a numpy array and hence it's values numpy types and also hence not serializable. Just my thoughts, hope it can help! If you need I can raise a new bug? |
Hey @dtpryce , Not sure I follow. In this case, wouldn't you need to call Regarding the original issue, @ryanpmccaffrey this should be already fixed in #664, so I'll be closing this one. |
I have the same problem when I run some Huggingface models using SeldonCore. After checking the output data, I made some changes in this pr #692 |
The output of certain huggingface models (e.g., pipelines with the task of token-classification) outputs values of type numpy.float32. Data of this type is not JSON serializable. Therefore, these models will fail when dumping the output, which is typically addressed with a post-processing step.
In mlserver-huggingface runtime.py before Line 86 could you add a post-processing fix to convert values from numpy.float32 to float?
Minimum viable code to reproduce issue:
The text was updated successfully, but these errors were encountered: