This week


Advanced: Customized Training

The past week training procedure is simple, but does not give you much control.

So now let's unpack the training loop, and implement it ourselves. This gives a starting point if, for example, to implement curriculum learning to help stabilize the model's open-loop output.

What is curriculum learning?

<aside> 💡 Curriculum learning describes a type of learning in which you first start out with only easy examples of a task and then gradually increase the task difficulty. We humans have been learning according to this principle for decades, yet we don’t transfer it to neural networks and instead let them train on the whole data set with all its difficulties from the beginning on. Link

</aside>

We will use tf.GradientTape to track the gradients. You can learn more about this approach by reading the eager execution guide.

The procedure works as follows:

Text generation with an RNN | TensorFlow Core

Le't create again our model as last week, the model is the same:

# Build the model
model = build_model(
  vocab_size = len(vocab),
  embedding_dim=embedding_dim,
  rnn_units=rnn_units,
  batch_size=BATCH_SIZE)

Now we set the optimizer for our parameters