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().
Bu egzersiz
Efficient AI Model Training with PyTorch
kursunun bir parçasıdırEgzersiz talimatları
- Enable mixed precision training for
Trainer.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
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()