user7420652
user7420652

Reputation: 183

How to save a tensorflow model trained in google datalab notebook for offline prediction?

I am using Google Cloud Datalab notebook to train my tensorflow model. I want to save the trained model for offline prediction. However, I am clueless on how to save the model. Should I use any tensorflow model saving method or is there any datalab/google cloud storage specific method to do so? Any help in this regard is highly appreciated.

Upvotes: 2

Views: 612

Answers (1)

Chris Meyers
Chris Meyers

Reputation: 1426

You can use any tensorflow model saving method, but I would suggest that you save it into a Google Cloud Storage bucket and not to local disk. Most tensorflow methods accept Google Cloud Storage paths in place of file names, using the gs:// prefix.

I would suggest using the SavedModelBuilder as it is currently the most portable. There is an example here: https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/flowers/trainer/model.py#L393

Upvotes: 2

Related Questions