设备做外贸哪个网站好,网站开发顶岗周记,汕头网站制作后缀,呼和浩特建设厅网站LLaMA-Factory 微调训练 该框架功能#xff0c;标注-微调-导出-合并-部署#xff0c;一整条流程都有#xff0c;而且训练时消耗的gpu算力也会小一些
一#xff0c;安装#xff08;推荐在linux中训练#xff0c;win可以用wsldocker#xff09;
git clone https://githu… LLaMA-Factory 微调训练 该框架功能标注-微调-导出-合并-部署一整条流程都有而且训练时消耗的gpu算力也会小一些
一安装推荐在linux中训练win可以用wsldocker
git clone https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory# 根据cuda版本选择安装pytoch版本
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# 提前把gpu版本的torch安装好
pip install -e .[torch,metrics]# 遇到包冲突时使用 pip install --no-deps -e . 解决# 测试torch是否可用gpu
命令行输入pythonimport torch
print(torch.cuda.is_available()) #返回True则说明torch可用gpu二训练 1数据集的准备和配置 参考https://github.com/hiyouga/LLaMA-Factory/blob/main/data/README_zh.md
# 我自己使用的是 角色对话 的数据集格式[{conversations: [{from: human,value: 人类指令},{from: gpt,value: 模型回答}],system: 系统提示词选填,}
]
需要同步修改 dataset_info.json 中的配置开始训练时会根据这个文件去找定义好的存放数据的json文件 yi_6b_chat: {file_name: yi_6b_chat_520_24000.json,formatting: sharegpt, # 表示数据使用的格式tags: { # 和数据集中的格式一一对应 role_tag: from,content_tag: value,user_tag: human,assistant_tag: gpt}},2训练启动web ui界面ui 界面训练只支持单卡多卡只能通过命令行训练
训练命令
CUDA_VISIBLE_DEVICES0 GRADIO_SHARE1 llamafactory-cli webui三vllm部署不一定是llama3的模型自己根据 llama3_vllm.yaml 配置修改就行配置文件中也可用修改用huggingface部署 1vllm安装很多坑pytorch版本和cuda版本必须保持一致兼容使用pytoch的docker镜像可用省事很多先看pytorch的版本pytorch版本11.812.1最好是cuda11.8版本的cuda和torch 2vllm启动会预先分配一定的显存也可用自行修改如还有其他应用要启动可用调低一些
启动命令
CUDA_VISIBLE_DEVICES0,1 API_PORT8000 llamafactory-cli api examples/inference/llama3_vllm.yaml