Skip to content
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

All numbers get converted to float when sending JSON resulting in unexpected behaviour in Proxies #703

Closed
axsaucedo opened this issue Jul 18, 2019 · 0 comments · Fixed by #707
Assignees
Projects

Comments

@axsaucedo
Copy link
Contributor

axsaucedo commented Jul 18, 2019

When sending a JSON request such as { "jsonData": { "instances": [{ "length": 9 }] } }, the number 9 would get converted into 9.0. This becomes an issue in the TFProxy as the number datatypes would be changed, resulting in unexpected behaviour that differs from sending the request directly to the TFX server.

This can be reproduced by running the following code:

from seldon_core.utils import seldon_message_to_json, json_to_seldon_message
seldon_message_to_json(
    json_to_seldon_message(
         { "jsonData": [ { "length": 9 } ] }
    )
)

Which outputs:

{'jsonData': [{'length': 9.0}]}

If you just run:

 json_to_seldon_message(
         { "jsonData": [ { "length": 9 } ] }
    )

You are able to see that the GRPC proto message converted is already changed to float:

list_value {
  values {
    struct_value {
      fields {
        key: "length"
        value {
          number_value: 9.0
        }
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.4.0
  
Done
Development

Successfully merging a pull request may close this issue.

1 participant