Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
6d95a35a
"src/vscode:/vscode.git/clone" did not exist on "0a08d41961220887c97074dcd585e52bba9f6220"
Unverified
Commit
6d95a35a
authored
May 18, 2025
by
fzyzcjy
Committed by
GitHub
May 17, 2025
Browse files
Support outputing details for bench_serving (#6107)
parent
01d2838c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
python/sglang/bench_serving.py
python/sglang/bench_serving.py
+22
-13
No files found.
python/sglang/bench_serving.py
View file @
6d95a35a
...
@@ -1380,21 +1380,24 @@ async def benchmark(
...
@@ -1380,21 +1380,24 @@ async def benchmark(
else
:
else
:
output_file_name
=
f
"
{
args
.
backend
}
_
{
now
}
_
{
args
.
num_prompts
}
_sharegpt.jsonl"
output_file_name
=
f
"
{
args
.
backend
}
_
{
now
}
_
{
args
.
num_prompts
}
_sharegpt.jsonl"
result_details
=
{
"input_lens"
:
[
output
.
prompt_len
for
output
in
outputs
],
"output_lens"
:
output_lens
,
"ttfts"
:
[
output
.
ttft
for
output
in
outputs
],
"itls"
:
[
output
.
itl
for
output
in
outputs
],
"generated_texts"
:
[
output
.
generated_text
for
output
in
outputs
],
"errors"
:
[
output
.
error
for
output
in
outputs
],
}
# Append results to a JSONL file
# Append results to a JSONL file
with
open
(
output_file_name
,
"a"
)
as
file
:
with
open
(
output_file_name
,
"a"
)
as
file
:
file
.
write
(
json
.
dumps
(
result
)
+
"
\n
"
)
if
args
.
output_details
:
result_for_dump
=
result
|
result_details
result
.
update
(
else
:
{
result_for_dump
=
result
"input_lens"
:
[
output
.
prompt_len
for
output
in
outputs
],
file
.
write
(
json
.
dumps
(
result_for_dump
)
+
"
\n
"
)
"output_lens"
:
output_lens
,
"ttfts"
:
[
output
.
ttft
for
output
in
outputs
],
return
result
|
result_details
"itls"
:
[
output
.
itl
for
output
in
outputs
],
"generated_texts"
:
[
output
.
generated_text
for
output
in
outputs
],
"errors"
:
[
output
.
error
for
output
in
outputs
],
}
)
return
result
def
check_chat_template
(
model_path
):
def
check_chat_template
(
model_path
):
...
@@ -1424,6 +1427,9 @@ def run_benchmark(args_: argparse.Namespace):
...
@@ -1424,6 +1427,9 @@ def run_benchmark(args_: argparse.Namespace):
if
not
hasattr
(
args
,
"warmup_requests"
):
if
not
hasattr
(
args
,
"warmup_requests"
):
args
.
warmup_requests
=
1
args
.
warmup_requests
=
1
if
not
hasattr
(
args
,
"output_details"
):
args
.
output_details
=
False
print
(
f
"benchmark_args=
{
args
}
"
)
print
(
f
"benchmark_args=
{
args
}
"
)
# Set global environments
# Set global environments
...
@@ -1668,6 +1674,9 @@ if __name__ == "__main__":
...
@@ -1668,6 +1674,9 @@ if __name__ == "__main__":
"if the server is not processing requests fast enough to keep up."
,
"if the server is not processing requests fast enough to keep up."
,
)
)
parser
.
add_argument
(
"--output-file"
,
type
=
str
,
help
=
"Output JSONL file name."
)
parser
.
add_argument
(
"--output-file"
,
type
=
str
,
help
=
"Output JSONL file name."
)
parser
.
add_argument
(
"--output-details"
,
action
=
"store_true"
,
help
=
"Output details of benchmarking."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--disable-tqdm"
,
"--disable-tqdm"
,
action
=
"store_true"
,
action
=
"store_true"
,
...
...
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