Set up the Trainer
Your model will replace complex phrases with simpler, more accessible paraphrases to improve the readability of translations. For example, it can simplify the original phrase "The inclement weather conditions precipitated the postponement of the outdoor event" with "The bad weather caused the outdoor event to be delayed." Build the Trainer to prepare training your language translation service! The exercise will take some time to run with the call to trainer.train().
Some data has been pre-loaded:
modelis a Transformer modeldatasetcontains the MRPC dataset of sentence paraphrasescompute_metricsfunction returns accuracy and F1 score- You've defined
training_argsin a prior exercise
Deze oefening maakt deel uit van de cursus
Efficient AI Model Training with PyTorch
Oefeninstructies
- Pass in the
modelto theTrainer()class. - Input the training arguments in the
Trainer()class. - Pass in a function to compute metrics to the
Trainer()class. - Print the device that the
trainerchooses.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
trainer = Trainer(
# Pass in the model
____=____,
# Input the training arguments
____=____,
train_dataset=dataset["train"],
eval_dataset=dataset["validation"],
# Pass in a function to compute metrics
compute_metrics=____,
)
trainer.train()
# Print the device that the trainer chooses
print(____.args.____)