開始使用免費開始

定義自訂配方

你正在為一位客戶微調預訓練的 Llama 模型,且對方需要特定的設定。你計畫使用 TorchTune 來進行微調,因此需要先準備一個 Python 字典,用來儲存你將用於執行微調工作的自訂配方需求。

本練習屬於課程

使用 Llama 3 進行微調

檢視課程

練習說明

  • 在你的字典中列出客戶需求:首先加入 torchtune.models.llama3_2.llama3_2_1b 模型。
  • 加入批次大小為 8以及GPU 裝置

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

config_dict = {
    # Define the model
    ____,
    # Define the batch size
    ____,
    # Define the device type
    ____,
    "epochs": 15,
    "optimizer": {"_component_": "bitsandbytes.optim.PagedAdamW8bit", "lr": 3e-05},
    "dataset": {"_component_": "custom_dataset"},
    "output_dir": "/tmp/finetune_results"
}
編輯並執行程式碼