import tensorflow as tf
model.compile(optimizer=optimizer)  # No loss argument!

This can be done by specifying where to push your model and tokenizer in the [~transformers.PushToHubCallback]:

from transformers.keras_callbacks import PushToHubCallback
callback = PushToHubCallback(
     output_dir="my_awesome_eli5_mlm_model",
     tokenizer=tokenizer,
 )