Skip to content

推理结果不变,每次同样的图像,同样的问题,答案都一样。如何答案多样性? #3978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xiaowenhe opened this issue Apr 24, 2025 · 0 comments

Comments

@xiaowenhe
Copy link

xiaowenhe commented Apr 24, 2025

`import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ['MAX_PIXELS'] = '1003520'
os.environ['VIDEO_MAX_PIXELS'] = '50176'
os.environ['FPS_MAX_FRAMES'] = '12'

from swift.llm import PtEngine, RequestConfig, InferRequest
model = 'Qwen/Qwen2.5-VL-7B-Instruct'

engine = PtEngine(model, max_batch_size=2)
request_config = RequestConfig(max_tokens=512, temperature=0)

infer_requests = [
InferRequest(messages=[{'role': 'user', 'content': '对该图像进行描述'}],
images=['xxxx.png'])
]
resp_list = engine.infer(infer_requests, request_config)
query0 = infer_requests[0].messages[0]['content']
print(f'response0: {resp_list[0].choices[0].message.content}')`

使用上述代码进行推理,每次答案都一样,没有多样性,请问如何才能使答案多样性?谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant