如何通过标准tensorflow服务docker镜像来服务模型的多个版本?

问题描述:

我是Tensorflow服务的新手,

I'm new to Tensorflow serving,

我刚刚尝试使用本教程并成功。

I just tried Tensorflow serving via docker with this tutorial and succeeded.

但是,当我尝试使用多个版本时,它仅提供最新版本

However, when I tried it with multiple versions, it serves only the latest version.

有可能这样做吗?还是我需要尝试一些不同的东西?

Is it possible to do that? Or do I need to try something different?

我找到了一种方法,可以通过构建自己的使用-model_config_file 选项代替-model_name -model_base_path

I found a way to achieve this by building my own docker image which uses --model_config_file option instead of --model_name and --model_base_path.

所以我正在使用以下命令运行tensorflow服务。

So I'm running tensorflow serving with below command.

docker运行-p 8501:8501 -v {local_path_of_models.conf}:/ models -t {docker_iamge_name}

当然,我写了'models 。

Of course, I wrote 'models.conf' for multiple models also.

编辑:

下面是什么我是从原始docker文件中修改的。

Below is what I modified from original docker file.

原始版本:

tensorflow_model_server --port = 8500 --rest_api_port = 8501 \
--model_name = $ {MODEL_NAME} --model_base_path = $ {MODEL_BASE_PATH} / $ {MODEL_NAME} \

修改版本:

tensorflow_model_server --port = 8500 --rest_api_port = 8501 \
--model_ config_file = $ {MODEL_BASE_PATH} /models.conf \