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
13f1357e
Unverified
Commit
13f1357e
authored
Sep 22, 2024
by
Lianmin Zheng
Committed by
GitHub
Sep 22, 2024
Browse files
Add a unit test for data parallelism (#1489)
parent
2a99993c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
.github/workflows/pr-test.yml
.github/workflows/pr-test.yml
+7
-1
test/srt/test_data_parallelism.py
test/srt/test_data_parallelism.py
+44
-0
No files found.
.github/workflows/pr-test.yml
View file @
13f1357e
...
...
@@ -228,7 +228,7 @@ jobs:
cd human-eval
pip install -e .
-
name
:
Evaluate Accuracy
-
name
:
Evaluate Accuracy
(TP=2)
timeout-minutes
:
20
run
:
|
cd test/srt
...
...
@@ -240,6 +240,12 @@ jobs:
cd test/srt
python3 test_mla.py
-
name
:
Evaluate Data Parallelism Accuracy (TP=2)
timeout-minutes
:
10
run
:
|
cd test/srt
python3 test_data_parallelism.py
finish
:
needs
:
[
unit-test-frontend
,
unit-test-backend-part-1
,
unit-test-backend-part-2
,
unit-test-backend-part-3
,
...
...
test/srt/test_data_parallelism.py
0 → 100644
View file @
13f1357e
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
TestDataParallelism
(
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
=
[
"--dp"
,
"2"
],
)
@
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