一.安装llama-factory
llama-factort的网站:https://github.com/hiyouga/LLaMA-Factory
安装llama-factory很简单,打开github后滑到安装 LLaMA Factory跟着步骤走即可。
安装 LLaMA Factory
git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory
pip install -e “.[torch,metrics]”
安装后到根目录执行
llamafactory-cli webui
可进行可视化,如下图所示:
即安装完成,接着进行微调。
二.开始微调。
1.数据准备:
需要将数据调整到Alpaca格式。
- Alpaca格式:alpaca 格式最初与Stanford大学的一个研究项目相关联,该项目旨在通过少量高质量的数据来微调大型语言模型。它受到了Alpaca模型(一种基于LLaMA的指令跟随模型)的影响,该模型是在Meta AI的LLaMA基础上进行改进而来的。
格式如下:{ "instruction": "Summarize the following text.", "input": "Artificial intelligence (AI) is a rapidly growing field...", "output": "AI is an evolving technology that is growing quickly in various fields...", "system": "system prompt (optional