如文档中所述,使用 version_labels
字段,您可以为模型版本指定标签以处理金丝雀部署。
例如,您可以将模型 43 标记为 stable
,将模型 44 标记为 canary
。
这个功能听起来很不错,但我没有在文档中找到如何调整我的 POST 请求以指定我想使用的标签。
直到现在,我一直在使用这样的东西:
curl -d '{"instances": <<my input data>>}' -X POST http://localhost:8501/v1/models/<<my model name>>:predict
有什么想法吗?
最佳答案
更新:
基于对 this 的评论GitHub Issue,@misterpeddy 指出,截至 2019 年 8 月 14 日:
Re: not being able to access the version using labels via HTTP - this is something that's not possible today (AFAIR) - only through the grpc interface can you declare labels :(
据我所知,此功能尚未实现。
原答案:
看起来 HTTP API 处理程序的当前实现希望版本为数字。
您可以看到尝试解析 URL here 的正则表达式.
prediction_api_regex_(
R"((?i)/v1/models/([^/:]+)(?:/versions/(\d+))?:(classify|regress|predict))")
\d
定义了对数字版本指示符而不是文本标签的期望。
我打开了相应的 TensorFlow Serving 问题 here .
关于tensorflow-serving - 如何在 REST API 请求中指定模型版本标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59237402/