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
30d8e130
Unverified
Commit
30d8e130
authored
Jul 24, 2024
by
Ying Sheng
Committed by
GitHub
Jul 24, 2024
Browse files
Improve benchmark scripts (#717)
parent
08a3bd19
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
benchmark/latency_throughput/bench_serving.py
benchmark/latency_throughput/bench_serving.py
+2
-2
python/sglang/bench_serving.py
python/sglang/bench_serving.py
+3
-0
python/sglang/srt/managers/controller/tp_worker.py
python/sglang/srt/managers/controller/tp_worker.py
+1
-5
No files found.
benchmark/latency_throughput/bench_serving.py
View file @
30d8e130
...
@@ -248,7 +248,7 @@ def main(args: argparse.Namespace):
...
@@ -248,7 +248,7 @@ def main(args: argparse.Namespace):
random
.
seed
(
args
.
seed
)
random
.
seed
(
args
.
seed
)
np
.
random
.
seed
(
args
.
seed
)
np
.
random
.
seed
(
args
.
seed
)
api_url
=
f
"
http://
{
args
.
host
}
:
{
args
.
port
}
/generate"
api_url
=
f
"
{
args
.
host
}
:
{
args
.
port
}
/generate"
if
args
.
tokenizer
.
endswith
(
".json"
)
or
args
.
tokenizer
.
endswith
(
".model"
):
if
args
.
tokenizer
.
endswith
(
".json"
)
or
args
.
tokenizer
.
endswith
(
".model"
):
from
sglang.srt.hf_transformers_utils
import
get_tokenizer
from
sglang.srt.hf_transformers_utils
import
get_tokenizer
...
@@ -333,7 +333,7 @@ if __name__ == "__main__":
...
@@ -333,7 +333,7 @@ if __name__ == "__main__":
default
=
"srt"
,
default
=
"srt"
,
choices
=
[
"vllm"
,
"tgi"
,
"srt"
,
"lightllm"
,
"ginfer"
],
choices
=
[
"vllm"
,
"tgi"
,
"srt"
,
"lightllm"
,
"ginfer"
],
)
)
parser
.
add_argument
(
"--host"
,
type
=
str
,
default
=
"localhost"
)
parser
.
add_argument
(
"--host"
,
type
=
str
,
default
=
"
http://
localhost"
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
30000
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
30000
)
parser
.
add_argument
(
"--dataset"
,
type
=
str
,
help
=
"Path to the dataset."
)
parser
.
add_argument
(
"--dataset"
,
type
=
str
,
help
=
"Path to the dataset."
)
parser
.
add_argument
(
"--input-len"
,
type
=
int
,
default
=
2048
)
parser
.
add_argument
(
"--input-len"
,
type
=
int
,
default
=
2048
)
...
...
python/sglang/bench_serving.py
View file @
30d8e130
...
@@ -5,6 +5,9 @@ Benchmark online serving.
...
@@ -5,6 +5,9 @@ Benchmark online serving.
Usage:
Usage:
python3 -m sglang.bench_serving --backend sglang --num-prompt 10
python3 -m sglang.bench_serving --backend sglang --num-prompt 10
python3 -m sglang.bench_serving --backend sglang --dataset-name random --num-prompts 3000 --random-input 1024 --random-output 1024 --random-range-ratio 0.5
python3 -m sglang.bench_serving --backend sglang --dataset-name random --request-rate-range 1,2,4,8,16,32 --random-input 4096 --random-output 1024 --random-range-ratio 0.125 --multi
"""
"""
import
argparse
import
argparse
...
...
python/sglang/srt/managers/controller/tp_worker.py
View file @
30d8e130
...
@@ -116,13 +116,9 @@ class ModelTpServer:
...
@@ -116,13 +116,9 @@ class ModelTpServer:
f
"[gpu_id=
{
self
.
gpu_id
}
] "
f
"[gpu_id=
{
self
.
gpu_id
}
] "
f
"max_total_num_tokens=
{
self
.
max_total_num_tokens
}
, "
f
"max_total_num_tokens=
{
self
.
max_total_num_tokens
}
, "
f
"max_prefill_tokens=
{
self
.
max_prefill_tokens
}
, "
f
"max_prefill_tokens=
{
self
.
max_prefill_tokens
}
, "
f
"max_running_requests=
{
self
.
max_running_requests
}
, "
f
"context_len=
{
self
.
model_config
.
context_len
}
"
f
"context_len=
{
self
.
model_config
.
context_len
}
"
)
)
if
self
.
tp_rank
==
0
:
logger
.
info
(
f
"[gpu_id=
{
self
.
gpu_id
}
] "
f
"server_args:
{
server_args
.
print_mode_args
()
}
"
)
# Init cache
# Init cache
self
.
tree_cache
=
RadixCache
(
self
.
tree_cache
=
RadixCache
(
...
...
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