QwenLM / Qwen2-VL

Qwen2-VL is the multimodal large language model series developed by Qwen team, Alibaba Cloud.
Apache License 2.0
3k stars 176 forks source link

RuntimeError: expected mat1 and mat2 to have the same dtype, but got: float != c10::BFloat16 #246

Open whitesay opened 1 month ago

whitesay commented 1 month ago

使用Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4,遇到报错RuntimeError: expected mat1 and mat2 to have the same dtype, but got: float != c10::BFloat16

whitesay commented 1 month ago

使用的推理代码和官方一致,如下:

text = processor.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
    text=[text],
    images=image_inputs,
    videos=video_inputs,
    padding=True,
    return_tensors="pt",
)

# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)

环境如下(python3.10,cuda12.1):

torch                     2.4.0                    pypi_0    pypi
torchvision               0.19.0                   pypi_0    pypi
transformers              4.45.0.dev0              pypi_0    pypi
transformers-stream-generator 0.0.4                    pypi_0    pypi
auto-gptq                 0.6.0.dev0+cu121           dev_0    <develop>
kq-chen commented 1 month ago

Could you please provide the full call stack and the full inference code when got error, so that I can reproduce the error?