dataset = dataset.map(tokenize_dataset)  # doctest: +SKIP
tf_dataset = model.prepare_tf_dataset(
        dataset["train"], batch_size=16, shuffle=True, tokenizer=tokenizer
    )  # doctest: +SKIP
   

When you're ready, you can call compile and fit to start training. Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to: