Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upTensorFlow Serving "version_labels" do not work as documented for the HTTP REST API #1555
Comments
|
@ericmclachlan, And if you observed that Numeric Labels are working fine and Non-Numeric Version Labels are resulting in error, can you please provide the Commands which you have used in both the cases (Numeric and Non-Numeric), and the respective Output or the Error. Thanks! |
|
Also, you can look at this article for more information about Configuring Different Versions for Serving. |
|
Hi @rmothukuru Thank you for the link but we already have TensorFlow Serving working in production. The problem lies specifically in trying to use the version_labels feature as described in the documentation. I have just confirmed that sending requests like the following yields predictions:
However, using a URL like this does not:
The only difference between these two is that this one uses the version_labels instead of the version itself. The exact error message I receive in the POST response is:
This is despite the model.config file containing the following version_labels definition:
I'm 99% sure this specific error message is being reported because this line in the code is failing; causing the "Malformed request" error defined in the previous few lines to be reported for this POST request. Thanks for your help in investigating this problem. |
|
@ericmclachlan,
|
|
@rmothukuru: I'm deploying the TensorFlow Server using docker-compose. Below is a simplied version:
This issue on GitHub confirms my observation and suggests:
This makes me sad. The limitations of the HTTP implementation should be made more transparent. This investigation has now needlessly cost my company money; as I'm sure it will continue to do for others. I'm not upset with you as an individual of course. But it is nonetheless a frustrating situation. |
|
@ericmclachlan just out of curiosity - how does the /config/batching_parameters.txt look like? |
|
Hi @Arnold1 The batching_parameters.txt looks like this:
Please let me know if anything seems off. |
|
Same problem! |
|
TensorFlow Serving "version_labels" only works using GRPC not REST API. |
|
@gowthamkpr: It would probably be helpful if the documentation describing labels mentioned this limitation upfront. It's less an issue of "This doesn't work" as much an issue of "I've just implemented REST and now I've discovered that this documented feature doesn't work unless I don't use REST." |
|
@ericmclachlan thanks for pointing out the lack of documentation on this - I've added a note [1] clarifying that version labels don't work for REST. @christisg how do we feel about fixing this? It's not a lot of work and I'd be happy to take it. We'd have 2 options:
Option 1) has the drawback of kinda odd behavior in that it implicitly disallows having version labels that can be parsed as int64 - which is currently undocumented behavior. WDYT? /cc @netfs in case he's thought about this before. [1] 9781ed1 |
|
Thanks @misterpeddy! How about Option 3) keep the current path and use explicit prefix for labels, i.e models/<model_name>/versions/label=<version_label> ? |
|
@misterpeddy, @christisg: I don't want to dilute the conversation too much; I just wanted to say thanks for seriously considering the suggestion. And thanks for all the work you're are doing for the community. |
|
Just a note that I have a preliminary implementation for the awesome idea @christisg mentioned and will resume with testing and merging it once we get some of our build breakage (due to incompatibilities with recent changes in upstream TF) under control. |
|
@misterpeddy Any update on this? Also, We have not moved to Tensorflow 2.0 yet. So, I was wondering if you guys will backport this fix to the older version of TFServing also. |


Bug Report
System information
tensorflow/serving:latest(downloaded around January 20th)Describe the problem
At a high level, the version_labels feature appears not to work correctly. (This feature is illustrated with the "canary" vs "stable" version labels example in the TensorFlow documentation).
More specifically, it may only work with simple numeric version labels.
The following URL will be rejected by TensorFlow Serving:
host/v1/models/my_model/versions/1.0:predictwith a
Malformed request...error.Exact Steps to Reproduce
I believe that any kind of non-numeric version label will fail. (i.e. The "canary" vs "stable" example itself should fail.)
Source code / logs
http_rest_api_handler.cc seems to define a regular expression used to parse the URL. Note that, after "versions", the regular expression defines an expectation for a numeric version.
It's possible that I misread the code, but this interpretation agrees with an observation on StackOverflow that numeric versions are handled correctly whereas text version labels are not.