Mixed precision training with Trainer
You want to simplify your training interface for mixed precision training. As an alternative to training loops with Accelerator, you've decided to build Trainer since your model doesn't require custom training loops. Set up Trainer to use mixed precision training! The exercise will take some time to run with the call to trainer.train().
Deze oefening maakt deel uit van de cursus
Efficient AI Model Training with PyTorch
Oefeninstructies
- Enable mixed precision training for
Trainer.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
training_args = TrainingArguments(
output_dir="./results",
evaluation_strategy="epoch",
# Enable mixed precision training
____=____
)
trainer = Trainer(model=model,
args=training_args,
train_dataset=dataset["train"],
eval_dataset=dataset["validation"],
compute_metrics=compute_metrics)
trainer.train()