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
92cb93f3
Unverified
Commit
92cb93f3
authored
Jun 22, 2024
by
Liangsheng Yin
Committed by
GitHub
Jun 22, 2024
Browse files
Fix latency benchmark (#557)
parent
e94e60d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
benchmark/latency_throughput/test_latency.py
benchmark/latency_throughput/test_latency.py
+5
-2
No files found.
benchmark/latency_throughput/test_latency.py
View file @
92cb93f3
import
argparse
import
argparse
import
random
import
time
import
time
import
requests
import
requests
...
@@ -9,6 +8,7 @@ if __name__ == "__main__":
...
@@ -9,6 +8,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"--host"
,
type
=
str
,
default
=
"http://127.0.0.1"
)
parser
.
add_argument
(
"--host"
,
type
=
str
,
default
=
"http://127.0.0.1"
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
None
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
None
)
parser
.
add_argument
(
"--backend"
,
type
=
str
,
default
=
"srt"
)
parser
.
add_argument
(
"--backend"
,
type
=
str
,
default
=
"srt"
)
parser
.
add_argument
(
"--max-tokens"
,
type
=
int
,
default
=
256
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
port
is
None
:
if
args
.
port
is
None
:
...
@@ -25,7 +25,7 @@ if __name__ == "__main__":
...
@@ -25,7 +25,7 @@ if __name__ == "__main__":
url
=
f
"
{
args
.
host
}
:
{
args
.
port
}
"
url
=
f
"
{
args
.
host
}
:
{
args
.
port
}
"
a
=
20
a
=
20
max_new_tokens
=
256
max_new_tokens
=
args
.
max_tokens
prompt
=
f
"
{
a
,
}
"
prompt
=
f
"
{
a
,
}
"
tic
=
time
.
time
()
tic
=
time
.
time
()
...
@@ -37,6 +37,7 @@ if __name__ == "__main__":
...
@@ -37,6 +37,7 @@ if __name__ == "__main__":
"sampling_params"
:
{
"sampling_params"
:
{
"temperature"
:
0
,
"temperature"
:
0
,
"max_new_tokens"
:
max_new_tokens
,
"max_new_tokens"
:
max_new_tokens
,
"ignore_eos"
:
True
,
},
},
},
},
)
)
...
@@ -48,6 +49,7 @@ if __name__ == "__main__":
...
@@ -48,6 +49,7 @@ if __name__ == "__main__":
"parameters"
:
{
"parameters"
:
{
"temperature"
:
0
,
"temperature"
:
0
,
"max_new_tokens"
:
max_new_tokens
,
"max_new_tokens"
:
max_new_tokens
,
"ignore_eos"
:
True
,
},
},
},
},
)
)
...
@@ -58,6 +60,7 @@ if __name__ == "__main__":
...
@@ -58,6 +60,7 @@ if __name__ == "__main__":
"prompt"
:
prompt
,
"prompt"
:
prompt
,
"temperature"
:
0
,
"temperature"
:
0
,
"max_tokens"
:
max_new_tokens
,
"max_tokens"
:
max_new_tokens
,
"ignore_eos"
:
True
,
},
},
)
)
elif
args
.
backend
==
"ginfer"
:
elif
args
.
backend
==
"ginfer"
:
...
...
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