serving icon indicating copy to clipboard operation
serving copied to clipboard

Loading models from google cloud storage

Open rajhans opened this issue 9 years ago • 8 comments

Is there a recommended way to load models from google cloud storage instead of a local directory? I can think of a few solutions:

  1. Create gcloud_storage_path_source.h parallel to file_system_storage_path_source.h by overriding source.h.
  2. Run a rsync daemon in the serving VM to sync models locally with gcloud storage, and then serve those models

Are there other recommended techniques out there for doing this?

Thanks!

rajhans avatar Oct 16 '17 18:10 rajhans

I believe there is already support for that. Did you try loading a model with a "gs://..." path? e.g. tensorflow_model_server --port=8080 --model_base_path=gs://...

kirilg avatar Oct 17 '17 20:10 kirilg

Yes, I did. I tried: bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --port=9000 --model_name=mnist --model_base_path=gs://team-models/mnist_models/

I got the following error:

2017-10-18 18:19:07.214881: E tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:370] FileSystemStoragePathSource encountered a file-system access error: Could not find base path gs://team-models/mnist_models/ for servable mnist

rajhans avatar Oct 18 '17 19:10 rajhans

Just to confirm, "team-models" is your bucket name and you have read access? What's the output of gsutil ls gs://team-models/mnist_models?

kirilg avatar Oct 18 '17 20:10 kirilg

You were right it does work. I was giving it a wrong folder name. Thanks very much!

rajhans avatar Oct 18 '17 21:10 rajhans

Can you link to the doc where this is explained?

anish714 avatar Mar 18 '19 20:03 anish714

Does this still work?

Can I do something like below? docker run -p 8500:8500 --mount type=bind,source=gs://<bucket-name>/Model,target=/models/Model -e MODEL_NAME=Model -t tensorflow/serving &

puneetjindal avatar Jul 09 '20 02:07 puneetjindal

You can use GCS directly in base_path like this:

tensorflow_model_server --port=8080 --model_base_path=gs://bucket_name/folder_models/

If you have your models in gs://bucket_name/serving_model, you can serve the latest model like this:

docker run -p 8501:8501 -e MODEL_BASE_PATH=gs://bucket_name -e MODEL_NAME=serving_model -t tensorflow/serving

axeltidemann avatar Dec 15 '21 14:12 axeltidemann