无法 运行 Tensorflow 服务使用配置文件

Unable run Tensorflow Serving using config file

我正在尝试 运行 tensorflow/serving docker 图像与配置文件。它抛出有关可服务文件系统访问的错误。我尝试使用单一模型和多个模型都不起作用。

docker执行命令如下

sudo docker run -p 8501:8501 --mount type=bind,source=/home/projects/models/model1/,target=/models/model1 --mount type=bind,source=/home/projects/models/model2/,target=/models/model2 --mount type=bind,source=/home/projects/config.conf,target=/models/config.conf -t tensorflow/serving --model_config_file=/models/config.conf

 "E tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:369] FileSystemStoragePathSource encountered a file-system access error: Could not find base path /home/projects/models/model1/ for servable model1
"

我的配置文件如下

model_config_list {
 config {
    name: 'model1',
    base_path: '/home/projects/models/model1/',
    model_platform: 'tensorflow'
  }
  config {
    name: 'model2',
    base_path: '/home/projects/models/model2/',
    model_platform: "tensorflow"
  }

}

但在不使用配置文件的情况下,我可以使用 docker 命令单独 运行 模型。

sudo docker run -t --rm -p 8501:8501    -v "/home/projects/models/model1:/models/model1"     -e MODEL_NAME=model1     tensorflow/serving &

无需分别挂载每个模型!您可以像这样安装所有模型:

sudo docker run \
-p 8501:8501 \
--mount type=bind,source=/home/projects/models/,target=/models/ \
-t tensorflow/serving \
--model_config_file=/models/config.conf

您的 config.conf 文件现在看起来像这样(将此文件放在 /home/projects/models/ 下):

model_config_list {
  config {
    name: 'model1',
    base_path: '/models/model1',
    model_platform: 'tensorflow'
  },
  config {
    name: 'model2',
    base_path: '/models/model2',
    model_platform: "tensorflow"
  },
}