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
54fb1c80
Unverified
Commit
54fb1c80
authored
Aug 10, 2024
by
Lianmin Zheng
Committed by
GitHub
Aug 10, 2024
Browse files
Clean up unit tests (#1020)
parent
b68c4c07
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
31 deletions
+10
-31
test/srt/test_skip_tokenizer_init.py
test/srt/test_skip_tokenizer_init.py
+7
-17
test/srt/test_srt_endpoint.py
test/srt/test_srt_endpoint.py
+1
-2
test/srt/test_torch_compile.py
test/srt/test_torch_compile.py
+1
-6
test/srt/test_vision_openai_server.py
test/srt/test_vision_openai_server.py
+1
-6
No files found.
test/srt/test_skip_tokenizer_
sr
t.py
→
test/srt/test_skip_tokenizer_
ini
t.py
View file @
54fb1c80
import
json
import
os
import
sys
import
unittest
import
requests
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
,
popen_launch_server
# os.environ["CUDA_VISIBLE_DEVICES"] = "1"
class
TestSRTEndpoint
(
unittest
.
TestCase
):
class
TestSkipTokenizerInit
(
unittest
.
TestCase
):
@
classmethod
def
setUpClass
(
cls
):
...
...
@@ -26,9 +21,7 @@ class TestSRTEndpoint(unittest.TestCase):
def
tearDownClass
(
cls
):
kill_child_process
(
cls
.
process
.
pid
)
def
run_decode
(
self
,
return_logprob
=
False
,
top_logprobs_num
=
0
,
return_text
=
False
,
n
=
1
):
def
run_decode
(
self
,
return_logprob
=
False
,
top_logprobs_num
=
0
,
n
=
1
):
response
=
requests
.
post
(
self
.
base_url
+
"/generate"
,
json
=
{
...
...
@@ -50,7 +43,6 @@ class TestSRTEndpoint(unittest.TestCase):
"stream"
:
False
,
"return_logprob"
:
return_logprob
,
"top_logprobs_num"
:
top_logprobs_num
,
"return_text_in_logprobs"
:
return_text
,
"logprob_start_len"
:
0
,
},
)
...
...
@@ -65,13 +57,11 @@ class TestSRTEndpoint(unittest.TestCase):
def
test_logprob
(
self
):
for
top_logprobs_num
in
[
0
,
3
]:
for
return_text
in
[
False
,
False
]:
self
.
run_decode
(
return_logprob
=
True
,
top_logprobs_num
=
top_logprobs_num
,
return_text
=
return_text
,
)
self
.
run_decode
(
return_logprob
=
True
,
top_logprobs_num
=
top_logprobs_num
,
)
if
__name__
==
"__main__"
:
unittest
.
main
(
warnings
=
"ignore"
)
unittest
.
main
()
test/srt/test_srt_endpoint.py
View file @
54fb1c80
...
...
@@ -4,7 +4,6 @@ import unittest
import
requests
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
,
popen_launch_server
...
...
@@ -59,4 +58,4 @@ class TestSRTEndpoint(unittest.TestCase):
if
__name__
==
"__main__"
:
unittest
.
main
(
warnings
=
"ignore"
)
unittest
.
main
()
test/srt/test_torch_compile.py
View file @
54fb1c80
...
...
@@ -34,9 +34,4 @@ class TestAccuracy(unittest.TestCase):
if
__name__
==
"__main__"
:
unittest
.
main
(
warnings
=
"ignore"
)
# t = TestAccuracy()
# t.setUpClass()
# t.test_mmlu()
# t.tearDownClass()
unittest
.
main
()
test/srt/test_vision_openai_server.py
View file @
54fb1c80
...
...
@@ -113,9 +113,4 @@ class TestOpenAIVisionServer(unittest.TestCase):
if
__name__
==
"__main__"
:
unittest
.
main
(
warnings
=
"ignore"
)
# t = TestOpenAIVisionServer()
# t.setUpClass()
# t.test_chat_completion()
# t.tearDownClass()
unittest
.
main
()
Prev
1
2
Next
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