Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
ccb58b23
Unverified
Commit
ccb58b23
authored
Apr 01, 2024
by
Roger Wang
Committed by
GitHub
Apr 01, 2024
Browse files
[Misc] Fix Benchmark TTFT Calculation for Chat Completions (#3768)
parent
49782fcb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
benchmarks/backend_request_func.py
benchmarks/backend_request_func.py
+3
-3
No files found.
benchmarks/backend_request_func.py
View file @
ccb58b23
...
@@ -334,7 +334,8 @@ async def async_request_openai_chat_completions(
...
@@ -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(
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment