2

I am trying to export my model to Google Cloud Storage. I used tf.contrib.learn to build my model and followed the iris classification example.

After my training and evaluation is done I would like to store the model on the cloud so I can make predictions, but I don't know how to export the model.

classifier = tf.contrib.learn.DNNClassifier(feature_columns=feature_columns,
                                            hidden_units=[100],
                                            n_classes=50,
                                            model_dir="Model_Logs")
Ali
  • 3,373
  • 5
  • 42
  • 54
  • There are several Iris examples floating around. Can you point to which one you are using. In addition, can you specify if you are training on cloud ml engine or locally? Either is fine, but potentially affects the answer – rhaertel80 Jun 23 '17 at 19:16
  • I am training on the cloud. Here is the iris example I followed https://www.tensorflow.org/get_started/tf learn. I only used it as a template. I have hosted my data on the cloud and was able to train my model. I am just having trouble exporting. – Akash Patwal Jun 23 '17 at 19:25

1 Answers1

0

The best example of training on the cloud is probably census (canned estimator) or census (custom estimator). They use the same Estimator API, so that part should be familiar. In addition, they use the Estimator class to help perform the training automatically. The train_and_evaluate method is called on that class by learn_runner.run, which will export the model if properly configured, which basically boils down to setting the export_strategy and the model_dir

If you want to do things outside the Experiment and learn_runner frameworks, you can just call Estimator.export_savedmodel

rhaertel80
  • 8,254
  • 1
  • 31
  • 47