Closed xyangk closed 3 years ago
Sorry, I did not quite get your question. Could you clarify it?
Sorry, I did not quite get your question. Could you clarify it?
I want my model output a uniform format like : {"outputs":{"scores":[0.936071157, 0.0527787767]}}
, key scores
is needed, I saved my model to output this format, see first SignatureDefs
picture.
I'm pretty sure that I saved it properly, I tested saved model use tf.saved_model.load
, but when I using tfserving serving this model, I got {"outputs": [ 0.936071038, 0.0527787916 ] }
, lost key scores
.
I don't know wether this problem came from tfserving or tensorflow, when I saved two keys scores
and give_up
, tfserving return {"outputs":{"scores":[0.936071157, 0.0527787767], "give_up":[0.936071157, 0.0527787767]}}
, now I have key scores
but with a redudant key give_up
, this is my temporary solution.
In my opinion, one key will lose, two keys will keep, did I describe the problem clearly?
Thanks for your clarification. It is intended. "If the output of the model contains only one named tensor, we omit the name and outputs key maps to a list of scalar or list values." More details: https://www.tensorflow.org/tfx/serving/api_rest#specifying_input_tensors_in_column_format.
Thanks for your clarification. It is intended. "If the output of the model contains only one named tensor, we omit the name and outputs key maps to a list of scalar or list values." More details: https://www.tensorflow.org/tfx/serving/api_rest#specifying_input_tensors_in_column_format.
Thanks for your reply, It helps. Sorry I missed this detail before. So my temporary solution actually is final solution.:sweat_smile:
Feel free to create a PR or file a feature request. Close this bug now.
I want the outputs from tfserving is:
{"outputs":{"scores":[0.936071157,0.0527787767]}}
but I got :{ "outputs": [ 0.936071038, 0.0527787916 ] }
Environment: python 3.6 tensorflow 2.3.0 tfserving 2.3.0
save model code:
By the way, model.model is tf.keras.Model :
SignatureDefs:
Start tfserving
What I got :(
But!, If model output two keys like
{"scores": out, "give_up":out}
, it works well.And the result:
I don't know why and didn't find any solution, Is there any kind person to help me ? Many thanks !