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
7d19de2e
Unverified
Commit
7d19de2e
authored
Jun 12, 2024
by
Michael Goin
Committed by
GitHub
Jun 12, 2024
Browse files
[Frontend] Add "input speed" to tqdm postfix alongside output speed (#5425)
parent
94a07bbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
vllm/entrypoints/llm.py
vllm/entrypoints/llm.py
+12
-5
No files found.
vllm/entrypoints/llm.py
View file @
7d19de2e
...
...
@@ -545,11 +545,13 @@ class LLM:
total
=
num_requests
,
desc
=
"Processed prompts"
,
dynamic_ncols
=
True
,
postfix
=
f
"Generation Speed:
{
0
:.
2
f
}
toks/s"
,
postfix
=
(
f
"est. speed input:
{
0
:.
2
f
}
toks/s, "
f
"output:
{
0
:.
2
f
}
toks/s"
),
)
# Run the engine.
outputs
:
List
[
Union
[
RequestOutput
,
EmbeddingRequestOutput
]]
=
[]
total_toks
=
0
total_in_toks
=
0
total_out_toks
=
0
while
self
.
llm_engine
.
has_unfinished_requests
():
step_outputs
=
self
.
llm_engine
.
step
()
for
output
in
step_outputs
:
...
...
@@ -558,10 +560,15 @@ class LLM:
if
use_tqdm
:
if
isinstance
(
output
,
RequestOutput
):
# Calculate tokens only for RequestOutput
total_toks
+=
sum
(
total_in_toks
+=
len
(
output
.
prompt_token_ids
)
in_spd
=
total_in_toks
/
pbar
.
format_dict
[
"elapsed"
]
total_out_toks
+=
sum
(
len
(
stp
.
token_ids
)
for
stp
in
output
.
outputs
)
spd
=
total_toks
/
pbar
.
format_dict
[
"elapsed"
]
pbar
.
postfix
=
f
"Generation Speed:
{
spd
:.
2
f
}
toks/s"
out_spd
=
total_out_toks
/
pbar
.
format_dict
[
"elapsed"
]
pbar
.
postfix
=
(
f
"est. speed input:
{
in_spd
:.
2
f
}
toks/s, "
f
"output:
{
out_spd
:.
2
f
}
toks/s"
)
pbar
.
update
(
1
)
if
use_tqdm
:
pbar
.
close
()
...
...
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