OpenBMB / MiniCPM-V

MiniCPM-V 2.6: A GPT-4V Level MLLM for Single Image, Multi Image and Video on Your Phone
Apache License 2.0
12.14k stars 849 forks source link

Lora微调后如何进行测试呢 #222

Closed lyc728 closed 3 months ago

lyc728 commented 4 months ago

预训练模型:MiniCPM-Llama3-V-2_5

model = AutoPeftModelForCausalLM.from_pretrained(
    # path to the output directory
    model_path,
    device_map="auto",
    trust_remote_code=True
).eval()

torch.manual_seed(0)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)

im_64 = '/6f8028485ed8fcd8.jpg'

# First round chat 
msgs = [{"role": "user", "content": "what is the date of the workshop? Answer the question with detailed explanation."}]

imagefile = Image.open(im_64).convert('RGB')
answer = model.chat(image=imagefile, msgs=msgs, tokenizer=tokenizer,
                         sampling=True,temperature=0.7, stream=True)
print(answer)
企业微信截图_17175881184738

推理后直接是在这样的,代码应该如何更改

qyc-98 commented 4 months ago

您好 关于lora微调 我们即将跟新一版代码,解决其中存在的一些问题,建议您在更新代码后重新进行lora微调。这次更新主要是解决了lora微调后,模型的视觉部分参数没有正常保存,导致您的训练失效,我们深感抱歉。您可以参考最新的lora加载方式,参见finetune下的readme.md。谢谢您的支持

lyc728 commented 4 months ago

您好 关于lora微调 我们即将跟新一版代码,解决其中存在的一些问题,建议您在更新代码后重新进行lora微调。这次更新主要是解决了lora微调后,模型的视觉部分参数没有正常保存,导致您的训练失效,我们深感抱歉。您可以参考最新的lora加载方式,参见finetune下的readme.md。谢谢您的支持

你是已经更新了吗?我现在正在微调训练

qyc-98 commented 4 months ago

您好 已经更新了 可以尝试一下

lihua8848 commented 3 months ago

Still have the same problem image

limllzu commented 3 months ago

你好,请问解决了吗,我在使用MiniCPM-V_2全量微调训练后,在加载模型时也遇到了问题