[Benchmark] Support sample from HF datasets and image input for benchmark_serving (#8495)

This commit is contained in:
Isotr0py
2024-09-17 15:34:27 +08:00
committed by GitHub
parent cbdb252259
commit 1b6de8352b
2 changed files with 177 additions and 68 deletions

View File

@@ -25,6 +25,7 @@ class RequestFuncInput:
best_of: int = 1
use_beam_search: bool = False
logprobs: Optional[int] = None
multi_modal_content: Optional[dict] = None
@dataclass
@@ -312,12 +313,15 @@ async def async_request_openai_chat_completions(
async with aiohttp.ClientSession(timeout=AIOHTTP_TIMEOUT) as session:
assert not request_func_input.use_beam_search
content = [{"type": "text", "text": request_func_input.prompt}]
if request_func_input.multi_modal_content:
content.append(request_func_input.multi_modal_content)
payload = {
"model": request_func_input.model,
"messages": [
{
"role": "user",
"content": request_func_input.prompt,
"content": content
},
],
"temperature": 0.0,