Scaling up Keras with Estimators

Kerala scaling with estimators

Did you know that you can convert the Keras model to the TensorFlow Estimator? It offers you a whole host of distributed training and scaling around options. We are going to develop a Keras model to run on a scale by converting it into a tensor flow estimator.

Complete Keras model, Estimator

So we have the Keras model; Easy to define, clear to read, and friendly to help. But we don't do it well for scaling on large datasets or running across multiple machines.

Fortunately, Keras and TensorFlow have some great interactive features.

All we want to do is convert our Keras model into a TensorFlow estimator, which comes with built-in distribution training. This is our ticket to solve our scale challenges.

Also, it makes it easier to serve the model once our training is complete.

Knight Gritty

The function we are interested in is called Model_to_estimator. The "model" part refers to the Keras model, while the "estimator" refers to the tensorflow estimator.
I picked up the notebook I started in the previous episode and updated it with the new code that converts our Keras model to the TensorFlow Estimator. We’ll take a look at how to export both your Keras model and your Tensorflow model, once the training is complete.

Walkthrough: Starting with Kegel, using Kegel

This is a short post - the real thing happens in the screencast below where I walk through the code!

I've recorded a screencast with my Kagle kernel to help explain how all of this goes down:

Getting distributed training using TensorFlow Estimators is an easy one-line adjustment to your Keras model. So now you have the best of both worlds: easy-to-read Keras model creation syntax, with training delivered via TensorFlow estimators.

Just remember to use Model_to_estimator to get all the training you need with your Keras model.

Kaggle Notebook →