Qwen-VL icon indicating copy to clipboard operation
Qwen-VL copied to clipboard

[BUG] <title>QwenVL2 阿里云百炼平台没法设置temperature和sample_num

Open zfj1998 opened this issue 1 year ago • 1 comments

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • [X] 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • [X] 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

我想设置temperature和sample_num, 可是百炼平台提供的API没法实现采样,设置了不同的温度后,生成的内容也没有区别

期望行为 | Expected Behavior

No response

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):

备注 | Anything else?

No response

zfj1998 avatar Aug 30 '24 08:08 zfj1998

一样。我使用

from transformers import Qwen2VLForConditionalGeneration
model = Qwen2VLForConditionalGeneration.from_pretrained(
    model_dir, torch_dtype="auto", device_map="auto",
)

加载的模型,然后尝试使用generation_config

model.generation_config.temperature=new_temperature
generated_ids = model.generate(**inputs,
                                   generation_config=model.generation_config,
                                   max_new_tokens=max_new_tokens)

和 LLAVA-style(直接将 temperature=0.2, do_sample=True 作为 generate() 的 kwargs 部分的参数),都无法观察到 decode 输出有任何改变。

llffff avatar Sep 19 '24 11:09 llffff