設定 Llama 的訓練參數
你的任務是微調用於客服聊天機器人的 Llama 模型,並以專為問答而建的客服資料進行微調。為了讓模型表現更好,你的團隊將使用 bitext 資料集來為這個任務微調一個 Llama 模型。
你想先試跑一次訓練迴圈,確認訓練腳本可正常運作。所以,你打算在訓練參數中先設定較小的學習率,並把訓練限制在少量步數。
本練習屬於課程
使用 Llama 3 進行微調
練習說明
- 匯入並建立用來儲存訓練參數的輔助類別實例。
- 將學習率的訓練參數設定為
2e-3。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Load helper class for the training arguments from the correct library
from ____ import ____
training_arguments = ____(
# Set learning rate
____=____,
warmup_ratio=0.03,
num_train_epochs=3,
output_dir='/tmp',
per_device_train_batch_size=1,
gradient_accumulation_steps=1,
save_steps=10,
logging_steps=2,
lr_scheduler_type='constant',
report_to='none'
)