Giter VIP home page Giter VIP logo

tensorflow_serving_examples's Introduction

本项目用于演示如何使用tensorflow/serving进行单模型与多模型部署以及模型预测。

拉取tensorflow/serving镜像:

docker pull tensorflow/serving:1.14.0

单模型部署命令:

docker run -t --rm -p 8551:8501 -v "absolute_path_to_pb_models/pb_models/add:/models/add" -e MODEL_NAME=add tensorflow/serving:1.14.0

多模型部署命令:

docker run -t -d --rm -p 8551:8501 -v "absolute_path_to_pb_models/pb_models:/models" tensorflow/serving:1.14.0 --model_config_file=/models/models.config

模型多版本部署命令:

docker run -t -d --rm -p 8551:8501 -v "absolute_path_to_pb_models/pb_models:/models" tensorflow/serving:1.14.0 --model_config_file=/models/models.config

模型预测:

参考single_tf_serving.pymulti_tf_serving.pyversion_control_tf_serving.py

curl命令:

curl --location --request POST 'http://192.168.1.193:8551/v1/models/add/versions/2:predict' \
--header 'Content-Type: application/json' \
--data-raw '{
    "instances": [{"t": 2}]
}'

输出:

{
    "predictions": [
        8.0
    ]
}

使用Prometheus进行服务监控

  1. Prothemus的配置文件位于./pb_models/prometheus.yml; Tensorflow/Serving支持Prothemus的配置文件位于pb_models/monitoring_config.txt;
  2. 启动服务:
docker-compose up -d
  1. 在浏览器中输入http://IP:9090, 选择Graph, 配置好Expression(比如:tensorflow:core:graph_run_time_usecs_histogram_count,调用次数)即可使用。

tensorflow_serving_examples's People

Contributors

jclian91 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.