Tensorflow: `batch_size` or `steps` is required for `Tensor` or `NumPy` input data

The error happens because a tf.Dataset is provided to the argument validation_data of Model.fit, but Keras does not know how many steps to validate for. To solve this problem, you can just set the argument validation_steps. For example:

model.fit(train_data,
    batch_size=BATCH_SIZE,
    epochs=NUM_EPOCHS,
    validation_data=(validation_inputs, validation_targets),
    validation_steps=10)

NUM_EPOCHS=5
    model.fit(train_data,epochs= NUM_EPOCHS,
    validation_data=(validation_inputs, validation_targets),
    validation_steps=10,verbose=2)