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
6a846bb1
Unverified
Commit
6a846bb1
authored
Jul 21, 2024
by
zhyncs
Committed by
GitHub
Jul 21, 2024
Browse files
misc: update output file logic (#686)
parent
0fdb3127
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
30 deletions
+33
-30
python/sglang/bench_serving.py
python/sglang/bench_serving.py
+33
-30
No files found.
python/sglang/bench_serving.py
View file @
6a846bb1
...
@@ -612,39 +612,42 @@ async def benchmark(
...
@@ -612,39 +612,42 @@ async def benchmark(
print
(
"{:<40} {:<10.2f}"
.
format
(
"P99 ITL (ms):"
,
metrics
.
p99_itl_ms
))
print
(
"{:<40} {:<10.2f}"
.
format
(
"P99 ITL (ms):"
,
metrics
.
p99_itl_ms
))
print
(
"="
*
50
)
print
(
"="
*
50
)
if
enable_multi
:
if
(
if
(
metrics
.
median_ttft_ms
is
not
None
metrics
.
me
di
an_
ttft
_ms
is
not
None
and
metrics
.
mean_
itl
_ms
is
not
None
and
metrics
.
mean_itl_ms
is
not
None
and
metrics
.
output_throughput
is
not
None
and
metrics
.
output_throughput
is
not
None
):
):
result
=
{
result
=
{
"backend"
:
args
.
backend
,
"backend"
:
args
.
backend
,
"dataset_name"
:
args
.
dataset_name
,
"dataset_name"
:
args
.
dataset_nam
e
,
"request_rate"
:
request_rat
e
,
"request_rate"
:
request_rate
,
"total_input"
:
metrics
.
total_input
,
"total_
in
put"
:
metrics
.
total_
in
put
,
"total_
out
put"
:
metrics
.
total_
out
put
,
"total_output"
:
metrics
.
total_output
,
"median_ttft"
:
metrics
.
median_ttft_ms
,
"median_
ttft
"
:
metrics
.
me
di
an_
ttft
_ms
,
"median_
itl
"
:
metrics
.
mean_
itl
_ms
,
"median_itl"
:
metrics
.
mean_itl_ms
,
"output_token_throughput"
:
metrics
.
output_throughput
,
"output_token_throughput"
:
metrics
.
output_throughput
,
"sharegpt_output_len"
:
args
.
sharegpt_output_len
,
"sharegpt_out
put_len"
:
args
.
sharegpt_out
put_len
,
"random_in
put_len"
:
args
.
random_in
put_len
,
"random_
in
put_len"
:
args
.
random_
in
put_len
,
"random_
out
put_len"
:
args
.
random_
out
put_len
,
"random_
output_len
"
:
args
.
random_
output_len
,
"random_
range_ratio
"
:
args
.
random_
range_ratio
,
}
}
else
:
else
:
print
(
f
"Error running benchmark for request rate:
{
request_rate
}
"
)
print
(
f
"Error running benchmark for request rate:
{
request_rate
}
"
)
print
(
"-"
*
30
)
print
(
"-"
*
30
)
# Determine output file name
# Determine output file name
if
args
.
output_file
:
if
args
.
output_file
:
output_file_name
=
args
.
output_file
output_file_name
=
args
.
output_file
else
:
now
=
datetime
.
now
().
strftime
(
"%m%d"
)
if
args
.
dataset_name
==
"random"
:
output_file_name
=
f
"
{
args
.
backend
}
_
{
now
}
_
{
args
.
num_prompts
}
_
{
args
.
random_input_len
}
_
{
args
.
random_output_len
}
.jsonl"
else
:
else
:
now
=
datetime
.
now
().
strftime
(
"%m%d%H"
)
output_file_name
=
f
"
{
args
.
backend
}
_
{
now
}
_
{
args
.
num_prompts
}
_sharegpt.jsonl"
output_file_name
=
f
"
{
args
.
backend
}
_
{
now
}
.jsonl"
# 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
"
)
file
.
write
(
json
.
dumps
(
result
)
+
"
\n
"
)
result
=
{
result
=
{
"duration"
:
benchmark_duration
,
"duration"
:
benchmark_duration
,
...
...
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