TensorFlow Serving多模型配置路径错误问题求助
解决TensorFlow Serving中model.config路径找不到的问题
问题根源
你犯了一个典型的Docker路径映射错误:--model_config_file参数里写的是宿主机的文件路径,但Docker容器内部只能识别容器自身的文件系统路径,根本不知道宿主机的building-machine-learning-pipelines/Untitled Folder/...路径是什么。
你已经通过--mount把宿主机的model_config目录挂载到了容器的/models/model_config目录下,所以容器内的model.config实际路径是/models/model_config/model.config,不是你写的宿主机路径。
修正后的完整命令
把--model_config_file的参数替换成容器内的路径即可,完整命令如下:
docker run -p 8500:8500 \ -p 8501:8501 \ --mount type=bind,source="C:\Users\ASUS\building-machine-learning-pipelines\Untitled Folder\my_housing_model",target=/models/my_model \ --mount type=bind,source="C:\Users\ASUS\building-machine-learning-pipelines\Untitled Folder\model_config",target=/models/model_config \ -e MODEL_NAME=my_model \ -t tensorflow/serving --model_config_file="/models/model_config/model.config" \ --model_config_file_poll_wait_seconds=60
额外说明
Docker的bind mount是把宿主机的目录/文件映射到容器内的指定位置,容器里的程序必须用容器侧的target路径来访问这些挂载的内容,不能直接引用宿主机的路径。以后遇到类似挂载后的文件访问问题,都要记住这个逻辑:容器内用容器的路径,宿主机用宿主机的路径,两者通过mount的source和target关联。
内容的提问来源于stack exchange,提问作者Sawan Rawat
相关产品推荐
相关产品推荐

