1 TensorFlow Serving

1.1 工程结构

1.1.1 项目结构

  1. ├── modules # 此目录仅做模型参考,无需放到git的代码中
  2. └── demo
  3. └── 00000123
  4. ├── assets
  5. └── foo.txt
  6. ├── saved_model.pb
  7. └── variables
  8. ├── variables.data-00000-of-00001
  9. └── variables.index
  10. ├── README.md
  11. ├── .gitignore
  12. └── modules.config

1.1.2 系统目录结构

模型发布对应目录

  1. /modules #容器中挂载的目录

1.1.3 模型目录

  1. ├── modules
  2. └── demo
  3. └── 00000123
  4. ├── assets
  5. └── foo.txt
  6. ├── saved_model.pb
  7. └── variables
  8. ├── variables.data-00000-of-00001
  9. └── variables.index

1.2 模型配置上线

  1. model_config_list:{
  2. config:{
  3. # 健康检查,所有项目必备
  4. name:"demo",
  5. base_path:"/modules/demo",
  6. model_platform:"tensorflow",
  7. model_version_policy:{
  8. all:{}
  9. }
  10. }
  11. }

1.3 模型上传

将模型文件上传至挂载盘中

1.4 模型上线检查

接口检查验证

curl http://localhost:8501/v1/models/demo/versions/123/metadata

用用接口

curl -d ‘{“instances”: [1.0, 2.0, 5.0]}’ -X POST http://localhost:8501/v1/models/demo:predict