开始使用免费开始使用

保存自定义配方

客户现在提出了新的需求修改。这次,他们希望增加参数规模,并使用具有 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:
    ____
编辑并运行代码