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
308d0240
Unverified
Commit
308d0240
authored
Aug 25, 2024
by
Ying Sheng
Committed by
GitHub
Aug 25, 2024
Browse files
[CI] Fix the issue of unit test hanging (#1211)
parent
ab4990e4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
15 deletions
+27
-15
python/sglang/test/test_utils.py
python/sglang/test/test_utils.py
+9
-8
test/srt/models/test_embedding_models.py
test/srt/models/test_embedding_models.py
+6
-0
test/srt/models/test_generation_models.py
test/srt/models/test_generation_models.py
+6
-7
test/srt/run_suite.py
test/srt/run_suite.py
+6
-0
No files found.
python/sglang/test/test_utils.py
View file @
308d0240
...
...
@@ -460,24 +460,25 @@ def run_with_timeout(
return
ret_value
[
0
]
def
run_one_file
(
filename
,
out_queue
):
print
(
f
"
\n\n
Run
{
filename
}
\n\n
"
)
ret
=
unittest
.
main
(
module
=
None
,
argv
=
[
""
,
"-vb"
]
+
[
filename
])
def
run_unittest_files
(
files
:
List
[
str
],
timeout_per_file
:
float
):
tic
=
time
.
time
()
success
=
True
for
filename
in
files
:
out_queue
=
multiprocessing
.
Queue
()
p
=
multiprocessing
.
Process
(
target
=
run_one_file
,
args
=
(
filename
,
out_queue
))
def
func
():
print
(
f
"
\n\n
Run
{
filename
}
\n\n
"
)
ret
=
unittest
.
main
(
module
=
None
,
argv
=
[
""
,
"-vb"
]
+
[
filename
])
p
=
multiprocessing
.
Process
(
target
=
func
)
def
run_one_file
():
def
run_process
():
p
.
start
()
p
.
join
()
try
:
run_with_timeout
(
run_
one_file
,
timeout
=
timeout_per_file
)
run_with_timeout
(
run_
process
,
timeout
=
timeout_per_file
)
if
p
.
exitcode
!=
0
:
success
=
False
break
...
...
test/srt/models/test_embedding_models.py
View file @
308d0240
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
import
multiprocessing
as
mp
import
unittest
import
torch
...
...
@@ -71,4 +72,9 @@ class TestEmbeddingModels(unittest.TestCase):
if
__name__
==
"__main__"
:
try
:
mp
.
set_start_method
(
"spawn"
)
except
RuntimeError
:
pass
unittest
.
main
(
warnings
=
"ignore"
)
test/srt/models/test_generation_models.py
View file @
308d0240
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
import
multiprocessing
as
mp
import
unittest
import
torch
...
...
@@ -108,13 +109,6 @@ class TestGenerationModels(unittest.TestCase):
),
f
"Not all ROUGE-L scores are greater than
{
rouge_threshold
}
"
def
test_prefill_logits_and_output_strs
(
self
):
import
multiprocessing
as
mp
try
:
mp
.
set_start_method
(
"spawn"
)
except
RuntimeError
:
pass
for
(
model
,
tp_size
,
...
...
@@ -137,4 +131,9 @@ class TestGenerationModels(unittest.TestCase):
if
__name__
==
"__main__"
:
try
:
mp
.
set_start_method
(
"spawn"
)
except
RuntimeError
:
pass
unittest
.
main
(
warnings
=
"ignore"
)
test/srt/run_suite.py
View file @
308d0240
import
argparse
import
glob
import
multiprocessing
as
mp
from
sglang.test.test_utils
import
run_unittest_files
...
...
@@ -54,5 +55,10 @@ if __name__ == "__main__":
else
:
files
=
suites
[
args
.
suite
]
try
:
mp
.
set_start_method
(
"spawn"
)
except
RuntimeError
:
pass
exit_code
=
run_unittest_files
(
files
,
args
.
timeout_per_file
)
exit
(
exit_code
)
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