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
33b54e7c
Unverified
Commit
33b54e7c
authored
Sep 14, 2024
by
Ke Bao
Committed by
GitHub
Sep 15, 2024
Browse files
Add pytorch sampling backend ut (#1425)
parent
30b404ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
test/srt/run_suite.py
test/srt/run_suite.py
+1
-0
test/srt/test_pytorch_sampling_backend.py
test/srt/test_pytorch_sampling_backend.py
+44
-0
No files found.
test/srt/run_suite.py
View file @
33b54e7c
...
@@ -17,6 +17,7 @@ suites = {
...
@@ -17,6 +17,7 @@ suites = {
"test_skip_tokenizer_init.py"
,
"test_skip_tokenizer_init.py"
,
"test_torch_compile.py"
,
"test_torch_compile.py"
,
"test_triton_attn_backend.py"
,
"test_triton_attn_backend.py"
,
"test_pytorch_sampling_backend.py"
,
"test_update_weights.py"
,
"test_update_weights.py"
,
"test_vision_openai_server.py"
,
"test_vision_openai_server.py"
,
"test_server_args.py"
,
"test_server_args.py"
,
...
...
test/srt/test_pytorch_sampling_backend.py
0 → 100644
View file @
33b54e7c
import
unittest
from
types
import
SimpleNamespace
from
sglang.srt.utils
import
kill_child_process
from
sglang.test.run_eval
import
run_eval
from
sglang.test.test_utils
import
(
DEFAULT_MODEL_NAME_FOR_TEST
,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
,
DEFAULT_URL_FOR_TEST
,
popen_launch_server
,
)
class
TestPyTorchSamplingBackend
(
unittest
.
TestCase
):
@
classmethod
def
setUpClass
(
cls
):
cls
.
model
=
DEFAULT_MODEL_NAME_FOR_TEST
cls
.
base_url
=
DEFAULT_URL_FOR_TEST
cls
.
process
=
popen_launch_server
(
cls
.
model
,
cls
.
base_url
,
timeout
=
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
,
other_args
=
[
"--sampling-backend"
,
"pytorch"
],
)
@
classmethod
def
tearDownClass
(
cls
):
kill_child_process
(
cls
.
process
.
pid
)
def
test_mmlu
(
self
):
args
=
SimpleNamespace
(
base_url
=
self
.
base_url
,
model
=
self
.
model
,
eval_name
=
"mmlu"
,
num_examples
=
64
,
num_threads
=
32
,
)
metrics
=
run_eval
(
args
)
assert
metrics
[
"score"
]
>=
0.65
if
__name__
==
"__main__"
:
unittest
.
main
()
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