LLM-SFT

LLM-SFT

中文大模型微调(LLM-SFT), 数学指令数据集MWP-Instruct, 支持模型(ChatGLM-6B, LLaMA, Bloom-7B, baichuan-7B), 支持(LoRA, QLoRA, DeepSpeed, UI, TensorboardX), 支持(微调, 推理, 测评, 接口)等.

Stars: 122

Visit
 screenshot

LLM-SFT is a Chinese large model fine-tuning tool that supports models such as ChatGLM, LlaMA, Bloom, Baichuan-7B, and frameworks like LoRA, QLoRA, DeepSpeed, UI, and TensorboardX. It facilitates tasks like fine-tuning, inference, evaluation, and API integration. The tool provides pre-trained weights for various models and datasets for Chinese language processing. It requires specific versions of libraries like transformers and torch for different functionalities.

README:

LLM-SFT

中文大模型微调(LLM-SFT), 支持模型(ChatGLM, LlaMA, Bloom, Baichuan-7B), 支持(LoRA, QLoRA, DeepSpeed, UI, TensorboardX), 支持(微调, 推理, 测评, 接口)等.

踩坑

LoRA: ChatGLM已经微调比较好了, 垂直领域数据继续微调甚至会带来性能下降, 建议至多不超过200w-epoch(R=8的情况);
QLoRA: 不要使用.cuda(), GPU至少为英伟达图灵架构往上备注当前(2023.06)QLoRA只是节约显存, 并不能加速训练;

LoRA权重

Bloomz-7B-GPT4ForALL: https://huggingface.co/Macropodus/MWP-Instruct
ChatGLM-6B-GPT4ForALL: https://huggingface.co/Macropodus/MWP-Instruct
LlaMA-7B-GPT4ForALL: https://huggingface.co/Macropodus/MWP-Instruct
ChatGLM-6B-MWP: https://huggingface.co/Macropodus/MWP-Instruct

微调数据

  1. 原始数据来自https://github.com/LYH-YF/MWPToolkit

处理后的微调数据(多步计算+一/二元解方程)-MWP: https://huggingface.co/datasets/Macropodus/MWP-Instruct

  1. 大数加减乘除来自: https://github.com/liutiedong/goat.git

微调样例

地址: llm_sft/ft_chatglm

配置: llm_sft/ft_chatglm/config.py
训练: python train.py
推理: python predict.py
验证: python evaluation.py
接口: python post_api.py

环境配置

1.详见LLM-SFT/requirements.txt
transformers>=4.26.1
torch>=1.10.1
peft>=0.2.0

2.注意QLoRA需要的版本更高些, 详见LLM-SFT/llm_sft/ft_qlora/requirements.txt
transformers>=4.30.0.dev0
accelerate>=0.20.0.dev0
bitsandbytes>=0.39.0
peft>=0.4.0.dev0
torch>=1.13.1

数据集-中文

参考/感谢

Reference

For citing this work, you can refer to the present GitHub project. For example, with BibTeX:

@misc{Keras-TextClassification,
    howpublished = {\url{https://github.com/yongzhuo/LLM-SFT}},
    title = {LLM-SFT},
    author = {Yongzhuo Mo},
    publisher = {GitHub},
    year = {2023}
}

免责申明

本项目相关资源仅供学术研究之用,严禁用于商业用途。 使用涉及第三方代码的部分时,请严格遵循相应的开源协议。模型生成的内容受模型计算、随机性和量化精度损失等因素影响,本项目不对其准确性作出保证。对于模型输出的任何内容,本项目不承担任何法律责任,亦不对因使用相关资源和输出结果而可能产生的任何损失承担责任。

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for LLM-SFT

Similar Open Source Tools

For similar tasks

For similar jobs