【问题标题】:How to get model status in tensorflow serving如何在张量流服务中获取模型状态
【发布时间】:2018-08-09 15:44:05
【问题描述】:

我正在尝试用 Scala(或 Java)编写客户端,以获取 tensorflow 服务中的模型状态。看完目录下的所有proto文件:/serving/tensorflow_serving/apis,我想到了这两个文件:get_model_status.protomodel_service.proto 提供必要的 api 供我使用。但我的简单测试返回错误:“线程“主”io.grpc.StatusRuntimeException 中的异常:未实现”。这是代码sn-p:

val channel = ManagedChannelBuilder
    .forAddress(host, port)
    .usePlaintext(true)
    .asInstanceOf[ManagedChannelBuilder[_]]
    .build
val modelStub = tensorflow.serving.ModelServiceGrpc.newBlockingStub(channel)
val modelRequest = tensorflow.serving.GetModelStatus
    .GetModelStatusRequest
    .newBuilder
    .setModelSpec(ModelSpec.newBuilder.setName("x").setSignatureName("x"))
    .build
println(modelStub
    .getModelStatus(modelRequest)
    .getModelVersionStatusList
    .asScala)

错误“未实现”似乎表明我必须定义一个新签名以添加到元图中以处理请求并返回响应,这让我感到困惑,因为这个新签名不再是我想要检查的模型.我的问题是如何使用这个getModelStatus 函数?任何建议表示赞赏!

【问题讨论】:

    标签: java scala tensorflow tensorflow-serving


    【解决方案1】:

    回答我自己的问题:

    1. 以上代码正确;

    2. 无需定义额外的签名,使用正常导出的模型即可;

    3. 使用 tf_serving 版本 >= 1.5 解决了这个问题。

    当我使用 1.4 版本的 tf_serving 二进制文件时出现“未实现”错误。

    有关此过程的更多详细信息,您可以查看 /serving/tensorflow_serving/model_servers/tensorflow_model_server_test.py 中的官方 python 函数 testGetModelStatus /em>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-29
      • 2016-07-24
      • 1970-01-01
      • 2020-01-13
      • 1970-01-01
      • 1970-01-01
      • 2021-06-12
      相关资源
      最近更新 更多