tensorflowkerasgoogle-colaboratorytensorflow-estimatortensorflow2.0

Training does not complete it's first epoch in Tensorflow 2.0


I am trying to train a model in Google's Colab, using Tensorflow 2.0. However, the training does not finish it's first epoch. The step counter has reached 9144 of "unknown" (and still going):

enter image description here

Why is the message "unknown" being shown?

This is my sequential model:

enter image description here

Thanks for your help.


Solution

  • You are making use of tf.data's Dataset api where data is not necessarily loaded into memory and hence there is no way to know how long is the dataset and consequently, the number of batches cannot be calculated. Hence, in the first epoch, it comes as unknown, but after the first epoch, the denominator will be shown the correct number.

    Or else if you wish to see it in the first epoch itself, in the model.fit() you can set the number of batches yourself by making use of steps_per_epoch parameter in it and then you will not get unknown again in the first epoch. But for that ensure that your dataset is repeated as many times as the number of epochs using repeat() operation.

    Edit

    repeat() is a dataset operation which will repeat the dataset as many times you would like it to have. So you would be seeing all the elements in your dataset as many times as you set the repeat count.