Using F1 Score for Model Checkpoint throws an error
Hi @kurkurzz ,

Please provide the complete code snippet to reproduce the issue reported. I've tried to reproduce the issue [here](https://colab.research.google.com/gist/Varsha-anjanappa/6855e9a19e74be64edca3d3d45a85121/61336_v1.ipynb), please provide the dataset or dummy data.

Thank you!! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. I am having the same issue but with tracking MSE. This is also seen by others (https://stackoverflow.com/questions/76701617/the-following-arguments-are-not-supported-with-the-native-keras-format-opti). Appears to be related to ModelCheckpoint and passing an "options" argument which should no longer be present in the latest version of Keras. Hello,
This issue occurs when you try to use the F1Score metric with the default value for the weight argument in a multi-class or multi-label problem. This works only for binary classification problems. To make this work, you need to add 'macro' or 'weighted' depending on your data class imbalance in the F1Score instance during model compilation. 
This should fix the issue.  Hi @kurkurzz ,

In the current implementation,for F1-score metric if we go with default value for argument `average = None` and the use case is either `multi-class classification` or `multi-label classification` then this problem occurs. With all other options like `average = 'weighted'` or `'micro'` or `'macro'` it works as intended. Attached [gist](https://colab.sandbox.google.com/gist/SuryanarayanaY/b183243a24924ebe56c63c7622288587/f1_score.ipynb) for reference.

If `average=None`, no averaging is performed and `result()` will return the score for each class which is causing the error. Hi @kurkurzz ,

Since monitor = val_f1_score returns f1_score for each class when averaging=None, it is not possible to `save_best_only` model as it it ambiguous to compare the arrays of multiple values which is best.Hence the error but ambiguous.

For this case I am trying to propose a PR to fall back to `save_best_only = False` instead of raising an exception.
### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

2.13

### Custom code

Yes

### OS platform and distribution

Google Colab

### Mobile device

_No response_

### Python version

3.10

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

T4 15GB

### Current behavior?

Was using `tf.keras.metrics.F1Score` in `model.compile`. It works well, it will return f1_score and val_f1_score after every epoch. However, the problem arises if I also include `tf.keras.callbacks.ModelCheckpoint` in the `model.fit`, I got an error after the first epoch training.

The error are `The following argument(s) are not supported with the native Keras format: ['options']` if I use `monitor='val_loss'` and `ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()` if I use `monitor='val_f1_score'` .

Additional context: I am training a multi-label classification model. This might be the cause.

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
from tensorflow.keras.applications import ResNet50
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras import models, layers
from tensorflow.keras.layers import Dense, GlobalAveragePooling2D

def create_model():
	base_model = ResNet50(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
	model = models.Sequential()
	model.add(base_model)
	model.add(layers.GlobalAveragePooling2D())
	model.add(layers.Dense(10, activation='sigmoid'))
	return model

model = create_model()
model_checkpoint = tf.keras.callbacks.ModelCheckpoint(
    filepath=os.path.join('v5.keras'),
    monitor='val_f1_score',
    mode='max',
    save_best_only=True
)

model.compile(
	loss='binary_crossentropy',
optimizer=tf.keras.optimizers.Adam(learning_rate=0.00003),
	metrics = [ tf.keras.metrics.F1Score(threshold=0.5)]
)

history = model.fit(
    X_train,
    y_train,
    batch_size=64,
    epochs=1,
    validation_data=(X_test, y_test),
    callbacks=[model_checkpoint]
)
```


### Relevant log output

_No response_