看过this的github问题和this的stackoverflow帖子,我曾希望这可以正常工作。
好像传入环境变量MODEL_CONFIG_FILE
毫无影响。我正在通过docker-compose
运行此程序,但是使用docker-run
也遇到了同样的问题。
错误:
I tensorflow_serving/model_servers/server.cc:82] Building single TensorFlow model file config: model_name: model model_base_path: /models/model
I tensorflow_serving/model_servers/server_core.cc:461] Adding/updating models.
I tensorflow_serving/model_servers/server_core.cc:558] (Re-)adding model: model
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 /models/model for servable model
Dockerfile
FROM tensorflow/serving:nightly
COPY ./models/first/ /models/first
COPY ./models/second/ /models/second
COPY ./config.conf /config/config.conf
ENV MODEL_CONFIG_FILE=/config/config.conf
撰写文件
version: '3'
services:
serving:
build: .
image: testing-models
container_name: tf
配置文件
model_config_list: {
config: {
name: "first",
base_path: "/models/first",
model_platform: "tensorflow",
model_version_policy: {
all: {}
}
},
config: {
name: "second",
base_path: "/models/second",
model_platform: "tensorflow",
model_version_policy: {
all: {}
}
}
}
答案 0 :(得分:3)
我在Windows上遇到git bash的this双斜线问题。
因此,我通过kotlin
中的command
将@ KrisR89提到的参数传递给了
新的docker-compose
如下所示,并可以与提供的docker-compose
一起使用:
dockerfile
答案 1 :(得分:2)
没有名为“ MODEL_CONFIG_FILE”的docker环境变量(这是一个tensorflow / serving变量,请参阅docker image link),因此docker image仅使用默认的docker环境变量(“ MODEL_NAME = model”和“ MODEL_BASE_PATH = / models”),并在docker映像启动时运行模型“ / models / model”。 在“ tensorflow / serving”启动时,应将“ config.conf”用作输入。 尝试改为运行以下内容:
nmap
答案 2 :(得分:-1)
该错误是由于服务无法找到您的模型。
I tensorflow_serving/model_servers/server.cc:82] Building single TensorFlow model file config: model_name: model model_base_path: /models/model
I tensorflow_serving/model_servers/server_core.cc:461] Adding/updating models.
I tensorflow_serving/model_servers/server_core.cc:558] (Re-)adding model: model
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 /models/model for servable model
您的docker compose文件未在容器中装载您的模型文件。因此,服务部门找不到您的模型。
version: '3'
services:
serving:
build: .
image: testing-models
container_name: tf
将模型文件从主机安装到容器。我认为您可以这样做:
version: "3"
services:
serving:
image: tensorflow/serving:latest
restart: unless-stopped
ports:
- 8501:8501
volumes:
- ${FIRST_MODEL_PATH <HOST>}:/models/${FIRST_MODEL_NAME}
- ${SECOND_MODEL_PATH <HOST>}:/models/${SECOND_MODEL_NAME}
- <HOST PATH>/models.config:/models/models.config
command: --model_config_file=/models/models.config
将{PATH}和{MODEL_NAME}替换为您的路径和型号名称。
models.config
文件密钥versions
应该设置。
model_config_list: {
config: {
name: "first",
base_path: "/models/first",
model_platform: "tensorflow",
model_version_policy: {
versions: 1
versions: 2
}
},
config: {
name: "second",
base_path: "/models/second",
model_platform: "tensorflow",
model_version_policy: {
versions: 1
versions: 2
}
}
}