ChatGLM微调

ChatGLM微调

清华大学最近新出了第二代chatGLM必须尝鲜一下。

下载chatGLM模型非常费劲,下载之后进行模型测试运行。


from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained('/mode/path', trust_remote_code=True)

model = AutoModel.from_pretrained('/model/path', trust_remote_code=True,device='cuda')

model = model.eval()

model.chat(tokenizer, "测试测试")


我们使用 chatGLM-efficient-Tuning 项目进行微调。使用lora模型

微调也很方便:



自定义好训练数据


python src/train_sft.py  --do_train --use_v2  --finetuing_type lora

使用web登录测试,效果还可以