You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returns: { "error": "Failed to process element: 0 key: speed of \'instances\' list. Error: Invalid argument: Cannot convert JSON value: 0.96 to float without loss of precision." }
curl -d '{"instances": [1.0,2.0,5.0]}' -X POST http://localhost:8501/v1/models/half_plus_three:predict
returns fine: { "predictions": [3.5, 4.0, 5.5 ]
while changing one of the numbers, for example: curl -d '{"instances": [1.24,5.0]}' -X POST http://localhost:8501/v1/models/half_plus_three:predict
returns: { "error": "Failed to process element: 0 of \'instances\' list. Error: Invalid argument: Cannot convert JSON value: 1.24 to float without loss of precision." }
The text was updated successfully, but these errors were encountered:
I am seeing the same behavior on Windows 10, running Tensorflow Serving through a docker image. HTTP requests return successfully for floating point numbers with less than 2 numbers after the decimal point, but fail with more precision.
The error message returned:
{ "error": "Failed to process element: 0 of 'instances' list. Error: Invalid argument: Cannot convert JSON value: 234.04 to float without loss of precision." }
Underlying rapidjson::IsLosslessFloat() does not work correctly
(e.g. IsLosslessFloat(0.2) returns false!). We now split the
range check into two parts: one to check if a integral value
can fit in float/double without loss and other part to do usual
decimal compare against the defined limits. The latter is used
for non-integer values.
Fixestensorflow#1136
PiperOrigin-RevId: 217166796
(cherry picked from commit 01c2fb8)
Bug Report
System information
Describe the problem
I believe there is an issue with how the json numbers are checked
https://github.com/tensorflow/serving/blob/master/tensorflow_serving/util/json_tensor.cc#L210
Example:
curl -X POST http://localhost:8501/v1/models/estimator:predict -H 'cache-control: no-cache' -d '{ "signature_name": "predict", "instances": [{"speed": 0.96 }] }'
returns:
{ "error": "Failed to process element: 0 key: speed of \'instances\' list. Error: Invalid argument: Cannot convert JSON value: 0.96 to float without loss of precision." }
Another example when testing the example in https://www.tensorflow.org/serving/api_rest#example
curl -d '{"instances": [1.0,2.0,5.0]}' -X POST http://localhost:8501/v1/models/half_plus_three:predict
returns fine:
{ "predictions": [3.5, 4.0, 5.5 ]
while changing one of the numbers, for example:
curl -d '{"instances": [1.24,5.0]}' -X POST http://localhost:8501/v1/models/half_plus_three:predict
returns:
{ "error": "Failed to process element: 0 of \'instances\' list. Error: Invalid argument: Cannot convert JSON value: 1.24 to float without loss of precision." }
The text was updated successfully, but these errors were encountered: