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
65050a40
Unverified
Commit
65050a40
authored
Oct 22, 2024
by
Chen Zhang
Committed by
GitHub
Oct 22, 2024
Browse files
[Bugfix] Generate exactly input_len tokens in benchmark_throughput (#9592)
parent
208cb34c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
benchmarks/benchmark_throughput.py
benchmarks/benchmark_throughput.py
+10
-1
No files found.
benchmarks/benchmark_throughput.py
View file @
65050a40
...
@@ -233,7 +233,16 @@ def main(args: argparse.Namespace):
...
@@ -233,7 +233,16 @@ def main(args: argparse.Namespace):
args
.
tokenizer
,
trust_remote_code
=
args
.
trust_remote_code
)
args
.
tokenizer
,
trust_remote_code
=
args
.
trust_remote_code
)
if
args
.
dataset
is
None
:
if
args
.
dataset
is
None
:
# Synthesize a prompt with the given input length.
# Synthesize a prompt with the given input length.
prompt
=
"hi"
*
(
args
.
input_len
-
1
)
# As tokenizer may add additional tokens like BOS, we need to try
# different lengths to get the desired input length.
for
i
in
range
(
-
10
,
10
):
prompt
=
"hi "
*
(
args
.
input_len
+
i
)
tokenized_prompt
=
tokenizer
(
prompt
).
input_ids
if
len
(
tokenized_prompt
)
==
args
.
input_len
:
break
else
:
raise
ValueError
(
f
"Failed to synthesize a prompt with
{
args
.
input_len
}
tokens."
)
requests
=
[(
prompt
,
args
.
input_len
,
args
.
output_len
)
requests
=
[(
prompt
,
args
.
input_len
,
args
.
output_len
)
for
_
in
range
(
args
.
num_prompts
)]
for
_
in
range
(
args
.
num_prompts
)]
else
:
else
:
...
...
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