I am fitting a huggingface model and trying to set up an early stopping when the sparse_validation_accuracy is better than 95%.
I am using the following call:
early_stopper = tf.keras.callbacks.EarlyStopping(monitor='accuracy',
baseline = 0.90,
patience = 0,
restore_best_weights=True)
# train the model
model.fit(train_dataset.shuffle(len(x_train)).batch(BATCH_SIZE),
epochs=N_EPOCHS,
batch_size=BATCH_SIZE,
callbacks = [early_stopper])
Unfortunately, the model keeps training as shown below. Am I missing something?
0.9688WARNING:tensorflow:Callbacks method `on_train_batch_end` is slow compared to the batch time (batch time: 0.6875s vs `on_train_batch_end` time: 1.1250s). Check your callbacks.
73/7495 [..............................] - ETA: 3:43:56 - loss: 0.1147 - sparse_categorical_accuracy: 0.9546