[[open-in-colab]]
In this tutorial, we will show you how to fine-tune a pretrained model from the Transformers library. In TensorFlow,
models can be directly trained using Keras and the fit method. In PyTorch, there is no generic training loop so
the 🤗 Transformers library provides an API with the class [Trainer] to let you fine-tune or train
a model from scratch easily. Then we will show you how to alternatively write the whole training loop in PyTorch.
Before we can fine-tune a model, we need a dataset. In this tutorial, we will show you how to fine-tune BERT on the
IMDB dataset: the task is to classify whether movie reviews are positive or
negative. For examples of other tasks, refer to the additional-resources section!
Preparing the datasets
We will use the 🤗 Datasets library to download and preprocess the IMDB
