serving icon indicating copy to clipboard operation
serving copied to clipboard

Problem on Building Serving Image with Multiple Models with Config

Open gabbygab1233 opened this issue 3 years ago • 2 comments

I don’t have a problem when creating my own serving image in docker using 1 model but when I try to build a serving image with multiple models it doesn’t work.

Here’s the command I used:

Create Serving Image

docker run -d --name serving_base tensorflow/serving

Copy SavedModel

docker cp /home/model1 serving_base:/models/model1
docker cp /home/model2 serving_base:/models/model2
docker cp /home/model.config serving_base:/models/model.config

Commit

docker commit serving_base acvision

Stop Serving Base

docker kill serving base

Checking Docker image

image

docker run --rm --name serve_acvision -p8502:8501 -p8503:8501 -p8504:8501 -d acvision

Screenshot from 2021-10-05 13-46-56

Testing the Server

Screenshot from 2021-10-05 13-58-28

gabbygab1233 avatar Oct 05 '21 06:10 gabbygab1233

@gabbygab1233

Could you please refer the similar issues link1 and link2, and let us know if it helps. Thanks

pindinagesh avatar Oct 06 '21 12:10 pindinagesh

@gabbygab1233

Could you please refer the similar issues link1 and link2, and let us know if it helps. Thanks

I can run multiple models using tensorflow/serving

docker run -p 8500:8500 \
-p 8501:8501 \
--mount type=bind,source=/tmp/models,target=/models/my_model \
--mount type=bind,source=/tmp/models,target=/models/another_model \
--mount type=bind,source=/tmp/model_config,\
target=/models/model_config \
-e MODEL_NAME=my_model \
-t tensorflow/serving \
--model_config_file=/models/model_config

But I want to create my own serving image I follow this tutorial

image

So this is my serving image("AcVision") I'll copy all the models and config files

image

So now instead of using tensorflow/serving image I'm going to use my own image which is "AcVision"

I try to run my image using this command

docker run --rm --name serve_acvision -p8502:8501 -p8503:8501 -p8504:8501 -d acvision

So my question is do I still need to mount my models and config files on docker command even though I copy all my models and config files on my own serving image?

gabbygab1233 avatar Oct 07 '21 04:10 gabbygab1233

@gabbygab1233,

There is no need to mount the models and config files on docker command if you copy your models and configs files to your own serving image.

I tried the below method to create my own serving image and was able to serve my model using own serving image. I also tried with multiple models but it didn't worked for me. Creating your own image works for single model only.

Thank you!


docker pull tensorflow/serving
docker run -d --name serving_base tensorflow/serving
docker cp "$(pwd)/models/testdata/saved_model_half_plus_two_cpu" serving_base:/models/saved_model_half_plus_two_cpu
docker commit --change "ENV MODEL_NAME saved_model_half_plus_two_cpu" serving_base tensorflow_serving:2.11.0
docker kill serving_base
docker run -p 8501:8501 -t tensorflow_serving:2.11.0

Screenshot 2023-02-08 at 10 28 40 AM

singhniraj08 avatar Feb 08 '23 05:02 singhniraj08

Closing this due to inactivity. Please take a look into the answers provided above, feel free to reopen and post your comments(if you still have queries on this). Thank you!

singhniraj08 avatar Feb 20 '23 06:02 singhniraj08