You might need to restart your notebook at this stage to free some memory, or execute the following code:
python
del model
del pytorch_model
del trainer
torch.cuda.empty_cache()
Let's now see how to achieve the same results as in trainer section in PyTorch. First we need to
define the dataloaders, which we will use to iterate over batches. We just need to apply a bit of post-processing to
our tokenized_datasets before doing that to:
remove the columns corresponding to values the model does not expect (here the "text" column)
rename the column "label" to "labels" (because the model expect the argument to be named labels)
set the format of the datasets so they return PyTorch Tensors instead of lists.
Our tokenized_datasets has one method for each of those steps:
```python
tokenized_datasets = tokenized_datasets.remove_columns(["text"])
