儲存自訂配方
客戶現在提出了新的需求修改。這次他們希望增加參數量,並使用具有 3B 參數的 Llama 3.2 模型。你需要在字典中完成這項修改,然後將其儲存為一個 YAML 檔案。
yaml 函式庫已經預先匯入。
本練習屬於課程
使用 Llama 3 進行微調
練習說明
- 在你的字典中指定新的模型需求,也就是
torchtune.models.llama3_2.llama3_2_3b模型。 - 將這些需求儲存為名為
custom_recipe.yaml的 YAML 檔案。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
config_dict = {
# Update the model
____,
"batch_size": 8,
"device": "cuda",
"optimizer": {"_component_": "bitsandbytes.optim.PagedAdamW8bit", "lr": 3e-05},
"dataset": {"_component_": "custom_dataset"},
"output_dir": "/tmp/finetune_results"
}
# Save the updated configuration to a new YAML file
with open("custom_recipe.yaml", "w") as yaml_file:
____