FastChat
FastChat copied to clipboard
add seed params support from vllm_worker
trafficstars
Add seed parameter support for openai api protocol.
I tested vllm_worker:
python3 -m fastchat.serve.controller
CUDA_VISIBLE_DEVICES=0 python3 -m fastchat.serve.vllm_worker --model-path facebook/opt-125m --model-names opt-125m --controller http://localhost:21001 --port 31001 --worker-address http://localhost:31001
python3 -m fastchat.serve.openai_api_server --host 0.0.0.0 --controller-address http://127.0.0.1:21001 --port 8000
The following code will produce same output
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="token-abc123",
)
completion = client.chat.completions.create(
model="opt-125m",
messages=[
{"role": "user", "content": "Hello!"}
],
seed=1,
max_tokens=200,
)
print(completion.choices[0].message.content)
Note that other types of worker may not reproduce same output.
Maybe related to these issues: issue 3215, issue 3216
@infwinston what do you think? Makes perfect sense to me!