CV fine-tuning: trainer configuration
Now that you have prepared the dataset and adapted a pretrained model to the new classes, it is time to configure your trainer.
The TrainingArguments and Trainer have been loaded from the transformers library. The model (model) and dataset (dataset) have been loaded as you previously configured them.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Multi-Modal Models with Hugging Face
คำแนะนำการฝึกหัด
- Adjust the learning rate to
6e-5. - Provide the model, training data, and test data to the
Trainerinstance.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
training_args = TrainingArguments(
output_dir="dataset_finetune",
# Adjust the learning rate
____,
gradient_accumulation_steps=4,
num_train_epochs=3,
push_to_hub=False
)
trainer = Trainer(
# Provide the model and datasets
model=____,
args=training_args,
data_collator=data_collator,
train_dataset=____,
eval_dataset=____,
processing_class=image_processor,
compute_metrics=compute_metrics,
)