[Misc] Fix Benchmark TTFT Calculation for Chat Completions (#3768)
This commit is contained in:
parent
49782fcb76
commit
ccb58b23e6
@ -334,7 +334,8 @@ async def async_request_openai_chat_completions(
|
|||||||
timestamp = time.perf_counter()
|
timestamp = time.perf_counter()
|
||||||
data = json.loads(chunk)
|
data = json.loads(chunk)
|
||||||
|
|
||||||
if "content" in data["choices"][0]["delta"]:
|
delta = data["choices"][0]["delta"]
|
||||||
|
if delta.get("content", None):
|
||||||
# First token
|
# First token
|
||||||
if ttft == 0:
|
if ttft == 0:
|
||||||
ttft = time.perf_counter() - st
|
ttft = time.perf_counter() - st
|
||||||
@ -345,8 +346,7 @@ async def async_request_openai_chat_completions(
|
|||||||
output.itl.append(timestamp -
|
output.itl.append(timestamp -
|
||||||
most_recent_timestamp)
|
most_recent_timestamp)
|
||||||
|
|
||||||
generated_text += data["choices"][0]["delta"][
|
generated_text += delta["content"]
|
||||||
"content"]
|
|
||||||
|
|
||||||
most_recent_timestamp = timestamp
|
most_recent_timestamp = timestamp
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user