ChatGLM-Tuning icon indicating copy to clipboard operation
ChatGLM-Tuning copied to clipboard

训练后加载模型好像没有效果,这是什么情况?

Open skysing opened this issue 1 year ago • 5 comments

训练后加载模型,发现问答不生效,不是训练的内容,感觉好像还是原来模型的回答,LoRa不起作用了。 以下是加载模型的部分代码:

device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu")
model = AutoModel.from_pretrained("models/chatglm-6b", trust_remote_code=True, load_in_8bit=True, device_map='auto', revision="")
tokenizer = AutoTokenizer.from_pretrained("models/chatglm-6b", trust_remote_code=True,  revision="")
model = PeftModel.from_pretrained(model, "/home/glm/ChatGLM-Tuning/output")

skysing avatar May 27 '23 02:05 skysing

我也是这个状态,注释掉了peft之后和原来的输出一致,finetune数据集3k条,batchsize16训练了1kstep

TingJShen avatar Jun 20 '23 05:06 TingJShen

同上

yudonggithub avatar Jun 20 '23 08:06 yudonggithub

batchsize=16,你这是用了多少训练资源跑起来的?

tjulh avatar Jun 29 '23 06:06 tjulh

我也是,这是什么原因啊?

energy888666 avatar Aug 11 '23 10:08 energy888666

尝试一下增加model.merge_and_unload()

model = PeftModel.from_pretrained(model, lora_path)
model.merge_and_unload() # 增加这一句

DeviLeo avatar Sep 05 '23 09:09 DeviLeo