【问题标题】:TensorFlow model server - Could not resolve host POSTTensorFlow 模型服务器 - 无法解析主机 POST
【发布时间】:2020-08-06 13:16:09
【问题描述】:

我是 TensorFlow 的新手(使用 1.13)并尝试构建 TF 模型并在 docker 张量流模型服务器上提供它。 我已经导出了我的模型,安装了 docker 并使用以下命令启动了我的 docker 容器:

docker run -p 8501:8501 --name SN_TFlow
--mount type=bind,source=/tmp/service_model/export,target=/models
-e MODEL_NAME=1596551653 -t tensorflow/serving &

我可以看到我的容器正在运行,并且客户端中的行:“I tensorflow_serving/model_servers/server.cc:375] Exporting HTTP/REST API at:localhost:8501 ...”似乎表明一切都已启动并且按照文档运行。

但是,当我尝试使用 curl 命令测试我的模型时: $ curl -d '{"test_value": [40]}' \ -X POST http://localhost:8501/1/models/1596551653:predict

我收到一条消息说: URL 错误/非法格式或缺少 URL 无法解析主机 POST 我收到一条 404 消息。

我也试过简单地 curl http://localhost:8501/models/1/1596551653 但也找不到。 知道我缺少什么吗?谢谢

【问题讨论】:

    标签: docker tensorflow tensorflow-serving


    【解决方案1】:

    我在您的代码中观察到的问题是 curl 命令中间的 \

    如果命令超过一行,backslash\ 应出现在行尾。

    所以,下面的命令,

    $ curl -d ‘{"test_value": [40]}' \ -X POST
    
    http://localhost:8501/1/models/1596551653:predict
    

    应该改成如下图(把backslash移到最后):

    $ curl -d ‘{"test_value": [40]}' -X POST \
    
    http://localhost:8501/1/models/1596551653:predict
    

    另外,我们建议您在 1.x 中升级到最新版本的 Tensorflow,即 1.15 或到 2.3.0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-06
      • 1970-01-01
      • 1970-01-01
      • 2018-07-19
      • 1970-01-01
      • 1970-01-01
      • 2011-04-30
      相关资源
      最近更新 更多