ChatGLM-LLaMA-chinese-insturct
ChatGLM-LLaMA-chinese-insturct copied to clipboard
探索中文instruct数据在ChatGLM, LLaMA上的微调表现
ChatGLM-LLaMA-chinese-insturct
探索中文instruct数据在ChatGLM, LLaMA等LLM上微调表现,结合PEFT等方法降低资源需求。
大部分基于ChatGLM-6B、ChatGLM-Tuning和Aplaca-LoRA,感谢大佬们。
时间线 / Time line
- [2023-04-04] 在中文instruction数据上新微调了一版ChatGLM-6B,效果似乎提升了些,发布了微调后的权重。
- [2023-04-01] 扩充LLaMA的中文词表后,完成在中文instruction数据集belle上进行微调,发布了微调后的权重。
- [2023-03-28] 完成在中文instruction数据上使用Lora对LLaMA-7B进行微调,发布了微调后的权重。
- [2023-03-24] 完成在中文instruction数据上使用Lora对ChatGLM-6B进行微调,发布了微调后的权重。
样例展示 / Some Examples
对于一些生成语句重复现象,可以考虑调整可变参数以及利用规则化的后处理方式去规避。
ChatGLM-6B
ChatGLM-6B-5epoch
感觉这版效果更好,只不过instruction数据后面都会附带一个问题,不过既然格式一样,那就可以想办法规避



ChatGLM-6B-3epoch
LLaMa-7B
在中文上的效果不如ChatGLM-6B,但考虑其对中文的支持本来就不好,已经不错了(~~不知道有没有大佬可以尝试增强一下LLaMa的中文能力~~已经有了Chinese-LLaMA-Alpaca)
LLaMA-7B-belle
注:微调和预测代码和原始一样,但是注意要先根据Chinese-LLaMA-Alpaca的操作指引合并LoRA权重,生成全量模型权重,这样才是扩充了中文词表后的LLaMA。
LLaMA-7B-zh_data01


环境准备 / Preparing the Enviroment
conda env create -f env.yml -n bab
conda activate bab
pip install git+https://github.com/huggingface/peft.git
数据处理 / Processing the Data
Run bash dataprocess.sh
to process the data.
模型微调 / Finetune Your Model
ChatGLM-6B
Run bash finetune.sh
to finetune the model.
LLaMA-7B
Run python test_llama1.py
to finetune the model.
模型推理 / Inference with Your Model
You can also choose to interact with the model through the annotation section.
ChatGLM-6B
Run python infer.py
to do the inference. Show cases in the dataset by default.
LLaMA-7B
Run python generate_llama1.py
to do the inference. Show cases in the dataset by default.
友情链接
- kanchil: 一个探索小模型的潜力的开源项目