I'm following the Coursera TensorFlow Serving with Docker for Model Deployment course.

You have to train a simple Tensorflow model and export it in Protobuf.

tf.saved_model.save(model, path)

Then you have to deploy it with Docker and the tensorflow/serving image, as follows:

docker run -p 8500:8500 \ # Expose port 8500 for gRPC endpoints
           -p 8501:8501 \ # Expose port 8501 for REST endopoints
           --mount type=bind,\
           source=/path/amazon_review/,\ # Absolute path to the model
           target=/models/amazon_review \ # Where in the docker container load the model
           -e MODEL_NAME=amazon_review \ # Environment variable
           -t tensorflow/serving # Set the image to use

Everything goes well when the training and the deployment is on the same machine. However, when I train the model on the course machine and try to deploy it on my own Amazon EC2 instance, the deployment fails and I get the following error. The full stack trace can be found here.

2021-09-22 18:58:19.959241: E tensorflow_serving/util/retrier.cc:37] 
Loading servable: {name: amazon_review version: 1631554979} failed: Data loss: file is too short to be an sstable
         [[{{node RestoreV2}}]]

The error is not related to the deployment itself, but the loading of the saved model.

Related but not solving the issue:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.