大模型04期Function Call实践-进阶版作业 #44
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
一、作业内容:
二、作业步骤
1、通过https://hf-mirror.com/ 下载数据集Deepexi/function-calling-small
huggingface-cli downloadDeepexi/function-calling-small --repo-type dataset --revision main --local-dir-use-symlinks False --local-dir /code/function-callling
2、修改数据文件的key 为 instruction, input ,output, 原来是systemPrompt,userPrompt,assistantResponse。 可以打开csv文件直接手动修改---- PS, 粗粗看了下,这个数据集多条数据是重复的,不确定对训练结果是否有影响
3、修改配置文件llama3_8b_instruct_qlora_alpaca_e3_copy,主要修改数据文件目录,注视量化部分代码,并且将max_dataset_length设置为20000,控制训练数据的长度。详见下图。


这里有个问题,就是evaluation_inputs 未进行修改,直接用了原来配置文件默认的,不确定对训练结果有影响
evaluation_inputs = [
'请给我介绍五个上海的景点', 'Please tell me five scenic spots in Shanghai'
]
4、通过notebook 开始微调训练,训练成功
NPROC_PER_NODE=4 xtuner train /code/llama3_8b_instruct_qlora_alpaca_e3_copy.py --work-dir /userhome/llama3-8b-ft/function-calling --deepspeed deepspeed_zero3_offload
5、通过微调管理进行训练,修改runx.sh 配置微调训练任务。详见下图。
6、通过约19小时的训练,训练结束,一共是1764步,生成checkpoint文件



7、将checkpoint文件转为为HF格式
xtuner convert pth_to_hf /code/llama3_8b_instruct_qlora_alpaca_e3_copy.py /userhome/llama3-8b-ft/function-calling/iter_1764.pth /code/llama3-8b-ft/function-calling/iter_1764_hf
8、模型merge
xtuner convert merge /dataset/Llama-3-8B-Instruct/ /code/llama3-8b-ft/function-calling/iter_1764_hf/ /code/llama3-8b-ft/function-calling/merged --device cpu
9、 进行结果测试,如下图所示。测试结果跟教程不太相同,推测原因两个:1、数据集质量问题;2、训练过程中的测试问题用了配置文件默认的,未使用llama3_8b_instruct_qlora_agentflan_3e.py 文件中的问题。
可以尝试使用qwen模型做中文数据集的微调,此外,function call的微调可以适当提高context的长度,也就是参数max_length。
eval的数据不影响训练的。