使用PtEngine推理和vllm部署后推理,结果相差很大
你好,有一个推理问题想咨询下。
对qwen2.5-VL-7B进行rlhf训练,开启lora。对训练后得到的模型进行merge,模型地址为model_path。
swift export \ --adapters model_path \ --merge_lora true
两者的输入query简化如下
[{"role": "system", "content": "你是一个能够处理文字与图片信息的多模态智能助理。\n下面将给出用户的【输入信息】:"}, {"role": "user", "content": [{"type": "text", "text": "【原始问句】:帮我在app完成缴费,我的车牌号是#123456#。\n"}]}]
使用PtEngine进行推理,推理代码
request_config = RequestConfig(max_tokens=512, temperature=0)
metric = InferStats()
resp_list = engine.infer(query, request_config, metrics=[metric])
content = [i.choices[0].message.content for i in resp_list]
print(content)
打印结果如下:
<think>首先需要打开app来开始缴费流程。</think><answer>打开app。</answer><action>{"open_app": {"app_name": "AA"}}</action>
使用vllm部署,部署脚本如下:
vllm serve $model_path --port 8000 --host 0.0.0.0 --dtype float16 --served_model_name Qwen2.5-VL-7B-Instruct --max-model-len 12800
相同query请求vllm,请求参数max_tokens=512,temperature=0.0,和PtEngine保持一致,打印结果:
<think>首先需要点击输入框,然后逐个字符输入车牌号“123456”。</think><answer>点击输入框的第一个字符位置,准备输入车牌号的第一个字符。</answer><action>{"click": {"coordinates": [175, 155]}}</action>
PtEngine推理结果符合预期,vllm推理结果偏差太大了,甚至没有输入图片,但是却输出了click。请问这个会是什么原因导致的
你试试使用VllmEngine推理
我的也是这个情况,sft后推理跟vllm部署结果差很多
我的也是pt推理似乎有bug,每次都只输出一个字符
This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.
This issue has been automatically closed due to inactivity. If needed, it can be reopened.