开发环境
- Ubuntu 18.x
- Docker 18.x
- Tensorflow 1.x
文件目录
├── models //模型与config文件存放的目录
│ ├── models.config //配置文件
│ ├── saved_model_half_plus_two_cpu //模型文件
│ │ ├──1538687457 //版本号
│ │ │ ├── saved_model.pb
│ │ │ ├── variables
│ │ │ │ ├── variables.data-00000-of-00001
│ │ │ │ ├── variables.index
│ ├── super-resolution //模型文件,目录格式跟上面这个模型一样
│ ├── resnet //模型文件
配置文件内容
model_config_list {
config {
name: "resnet",
base_path: "/models/resnet"
model_platform: "tensorflow"
}
config {
name: "half_plus_two",
base_path: "/models/saved_model_half_plus_two_cpu"
model_platform: "tensorflow"
}
config {
name: "super-resolution",
base_path: "/models/super-resolution"
model_platform: "tensorflow"
}
}
serving命令
docker run -p 8500:8500 -p 8501:8501 \
--mount type=bind,source=/cmq/models/resnet/,target=/models/resnet \
--mount type=bind,source=/cmq/models/saved_model_half_plus_two_cpu/,target=/models/saved_model_half_plus_two_cpu \
--mount type=bind,source=/cmq/models/super-resolution/,target=/models/super-resolution \
--mount type=bind,source=/cmq/models/models.config,target=/models/models.config \
-t tensorflow/serving --model_config_file=/models/models.config
注意:mount 命令需要高版本的docker,如果是执行时报找不到命名mount命令的错,多半是你的docker版本低了,source 参数后面是绝对路径,逗号后面的不能有空格。