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
7514b9f8
Unverified
Commit
7514b9f8
authored
Aug 25, 2024
by
Mingyi
Committed by
GitHub
Aug 26, 2024
Browse files
[CI] Fix CI (#1217)
parent
158e8f1e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
27 deletions
+22
-27
python/sglang/test/test_utils.py
python/sglang/test/test_utils.py
+17
-18
test/srt/models/test_embedding_models.py
test/srt/models/test_embedding_models.py
+1
-1
test/srt/models/test_generation_models.py
test/srt/models/test_generation_models.py
+1
-1
test/srt/run_suite.py
test/srt/run_suite.py
+2
-6
test/srt/sampling/penaltylib/test_srt_endpoint_with_penalizers.py
.../sampling/penaltylib/test_srt_endpoint_with_penalizers.py
+1
-1
No files found.
python/sglang/test/test_utils.py
View file @
7514b9f8
...
@@ -2,12 +2,10 @@
...
@@ -2,12 +2,10 @@
import
argparse
import
argparse
import
asyncio
import
asyncio
import
multiprocessing
import
os
import
os
import
subprocess
import
subprocess
import
threading
import
threading
import
time
import
time
import
unittest
from
functools
import
partial
from
functools
import
partial
from
typing
import
Callable
,
List
,
Optional
from
typing
import
Callable
,
List
,
Optional
...
@@ -19,6 +17,7 @@ import torch.nn.functional as F
...
@@ -19,6 +17,7 @@ import torch.nn.functional as F
from
sglang.global_config
import
global_config
from
sglang.global_config
import
global_config
from
sglang.lang.backend.openai
import
OpenAI
from
sglang.lang.backend.openai
import
OpenAI
from
sglang.lang.backend.runtime_endpoint
import
RuntimeEndpoint
from
sglang.lang.backend.runtime_endpoint
import
RuntimeEndpoint
from
sglang.srt.utils
import
kill_child_process
from
sglang.utils
import
get_exception_traceback
from
sglang.utils
import
get_exception_traceback
DEFAULT_MODEL_NAME_FOR_TEST
=
"meta-llama/Meta-Llama-3.1-8B-Instruct"
DEFAULT_MODEL_NAME_FOR_TEST
=
"meta-llama/Meta-Llama-3.1-8B-Instruct"
...
@@ -457,35 +456,35 @@ def run_with_timeout(
...
@@ -457,35 +456,35 @@ def run_with_timeout(
return
ret_value
[
0
]
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
):
def
run_unittest_files
(
files
:
List
[
str
],
timeout_per_file
:
float
):
tic
=
time
.
time
()
tic
=
time
.
time
()
success
=
True
success
=
True
for
filename
in
files
:
for
filename
in
files
:
out_queue
=
multiprocessing
.
Queue
()
global
process
p
=
multiprocessing
.
Process
(
target
=
run_one_file
,
args
=
(
filename
,
out_queue
))
def
run_process
():
def
run_one_file
(
filename
):
p
.
start
()
filename
=
os
.
path
.
join
(
os
.
getcwd
(),
filename
)
p
.
join
()
print
(
f
"
\n\n
Run
{
filename
}
\n\n
"
)
process
=
subprocess
.
Popen
(
[
"python3"
,
filename
],
stdout
=
None
,
stderr
=
None
,
env
=
os
.
environ
)
process
.
wait
()
return
process
.
returncode
try
:
try
:
run_with_timeout
(
run_process
,
timeout
=
timeout_per_file
)
ret_code
=
run_with_timeout
(
if
p
.
exitcode
!=
0
:
run_one_file
,
args
=
(
filename
,),
timeout
=
timeout_per_file
success
=
False
)
break
assert
ret_code
==
0
except
TimeoutError
:
except
TimeoutError
:
p
.
terminate
(
)
kill_child_process
(
process
.
pid
)
time
.
sleep
(
5
)
time
.
sleep
(
5
)
print
(
print
(
f
"
\n
Timeout after
{
timeout_per_file
}
seconds when running
{
filename
}
\n
"
f
"
\n
Timeout after
{
timeout_per_file
}
seconds when running
{
filename
}
\n
"
)
)
return
False
success
=
False
break
if
success
:
if
success
:
print
(
f
"Success. Time elapsed:
{
time
.
time
()
-
tic
:.
2
f
}
s"
)
print
(
f
"Success. Time elapsed:
{
time
.
time
()
-
tic
:.
2
f
}
s"
)
...
...
test/srt/models/test_embedding_models.py
View file @
7514b9f8
...
@@ -77,4 +77,4 @@ if __name__ == "__main__":
...
@@ -77,4 +77,4 @@ if __name__ == "__main__":
except
RuntimeError
:
except
RuntimeError
:
pass
pass
unittest
.
main
(
warnings
=
"ignore"
)
unittest
.
main
()
test/srt/models/test_generation_models.py
View file @
7514b9f8
...
@@ -136,4 +136,4 @@ if __name__ == "__main__":
...
@@ -136,4 +136,4 @@ if __name__ == "__main__":
except
RuntimeError
:
except
RuntimeError
:
pass
pass
unittest
.
main
(
warnings
=
"ignore"
)
unittest
.
main
()
test/srt/run_suite.py
View file @
7514b9f8
...
@@ -7,7 +7,7 @@ from sglang.test.test_utils import run_unittest_files
...
@@ -7,7 +7,7 @@ from sglang.test.test_utils import run_unittest_files
suites
=
{
suites
=
{
"minimal"
:
[
"minimal"
:
[
"models/test_embedding_models.py"
,
"models/test_embedding_models.py"
,
#
"models/test_generation_models.py",
"models/test_generation_models.py"
,
"sampling/penaltylib"
,
"sampling/penaltylib"
,
"test_chunked_prefill.py"
,
"test_chunked_prefill.py"
,
"test_embedding_openai_server.py"
,
"test_embedding_openai_server.py"
,
...
@@ -33,6 +33,7 @@ for target_suite_name, target_tests in suites.items():
...
@@ -33,6 +33,7 @@ for target_suite_name, target_tests in suites.items():
tests
.
remove
(
target_suite_name
)
tests
.
remove
(
target_suite_name
)
tests
.
extend
(
target_tests
)
tests
.
extend
(
target_tests
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
arg_parser
=
argparse
.
ArgumentParser
()
arg_parser
=
argparse
.
ArgumentParser
()
arg_parser
.
add_argument
(
arg_parser
.
add_argument
(
...
@@ -55,10 +56,5 @@ if __name__ == "__main__":
...
@@ -55,10 +56,5 @@ if __name__ == "__main__":
else
:
else
:
files
=
suites
[
args
.
suite
]
files
=
suites
[
args
.
suite
]
try
:
mp
.
set_start_method
(
"spawn"
)
except
RuntimeError
:
pass
exit_code
=
run_unittest_files
(
files
,
args
.
timeout_per_file
)
exit_code
=
run_unittest_files
(
files
,
args
.
timeout_per_file
)
exit
(
exit_code
)
exit
(
exit_code
)
test/srt/sampling/penaltylib/test_srt_endpoint_with_penalizers.py
View file @
7514b9f8
...
@@ -112,4 +112,4 @@ class TestBatchPenalizerE2E(unittest.TestCase):
...
@@ -112,4 +112,4 @@ class TestBatchPenalizerE2E(unittest.TestCase):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
(
warnings
=
"ignore"
)
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