I was playing with this function from tf.data called tf.data.Dataset.from_generator() where it takes a ImageDataGenerator object and turns it into a Dataset Object. Everything was fine but when I fit my model I can’t use steps_per_epoch and validation_steps including them throws an error,

Screenshot 2021-05-20 at 3.39.15 AM1153×541 68.5 KB

TypeError: dataset length is unknown.
Then I commented them out and continued to fit the model but its training for infinitely seems there is no stopping. I have attached my images. (edited)

Screenshot 2021-05-20 at 3.15.58 AM709×637 42.8 KB

When I use .from_generator it automatically converts from ImageDatagenerator to a Dataset object but not sure why it’s still considering it as a generator and throwing error.
Any help on this?