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
zhaoyu6
sglang
Commits
60e37f80
"test/vscode:/vscode.git/clone" did not exist on "4f204db57cf96b3c85df427868f9d2f9949c46df"
Unverified
Commit
60e37f80
authored
Sep 02, 2025
by
Lianmin Zheng
Committed by
GitHub
Sep 02, 2025
Browse files
Move parsers under a single folder (#9912)
parent
369b1433
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
10 additions
and
10 deletions
+10
-10
python/sglang/srt/parser/reasoning_parser.py
python/sglang/srt/parser/reasoning_parser.py
+1
-1
python/sglang/srt/server_args.py
python/sglang/srt/server_args.py
+1
-1
test/lang/test_separate_reasoning_execution.py
test/lang/test_separate_reasoning_execution.py
+3
-3
test/srt/test_harmony_parser.py
test/srt/test_harmony_parser.py
+1
-1
test/srt/test_jinja_template_utils.py
test/srt/test_jinja_template_utils.py
+1
-1
test/srt/test_reasoning_parser.py
test/srt/test_reasoning_parser.py
+1
-1
test/srt/test_vlm_accuracy.py
test/srt/test_vlm_accuracy.py
+1
-1
test/srt/test_vlm_input_format.py
test/srt/test_vlm_input_format.py
+1
-1
No files found.
python/sglang/srt/reasoning_parser.py
→
python/sglang/srt/
parser/
reasoning_parser.py
View file @
60e37f80
import
re
import
re
from
typing
import
Dict
,
Optional
,
Tuple
,
Type
from
typing
import
Dict
,
Optional
,
Tuple
,
Type
from
sglang.srt.harmony_parser
import
HarmonyParser
from
sglang.srt.
parser.
harmony_parser
import
HarmonyParser
class
StreamingParseResult
:
class
StreamingParseResult
:
...
...
python/sglang/srt/server_args.py
View file @
60e37f80
...
@@ -26,7 +26,7 @@ from typing import List, Literal, Optional, Union
...
@@ -26,7 +26,7 @@ from typing import List, Literal, Optional, Union
from
sglang.srt.function_call.function_call_parser
import
FunctionCallParser
from
sglang.srt.function_call.function_call_parser
import
FunctionCallParser
from
sglang.srt.hf_transformers_utils
import
check_gguf_file
,
get_config
from
sglang.srt.hf_transformers_utils
import
check_gguf_file
,
get_config
from
sglang.srt.lora.lora_registry
import
LoRARef
from
sglang.srt.lora.lora_registry
import
LoRARef
from
sglang.srt.reasoning_parser
import
ReasoningParser
from
sglang.srt.
parser.
reasoning_parser
import
ReasoningParser
from
sglang.srt.utils
import
(
from
sglang.srt.utils
import
(
LORA_TARGET_ALL_MODULES
,
LORA_TARGET_ALL_MODULES
,
SUPPORTED_LORA_TARGET_MODULES
,
SUPPORTED_LORA_TARGET_MODULES
,
...
...
test/lang/test_separate_reasoning_execution.py
View file @
60e37f80
...
@@ -64,7 +64,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
...
@@ -64,7 +64,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
for
ev
in
self
.
events
:
for
ev
in
self
.
events
:
ev
.
set
()
ev
.
set
()
@
patch
(
"sglang.srt.reasoning_parser.ReasoningParser"
)
@
patch
(
"sglang.srt.
parser.
reasoning_parser.ReasoningParser"
)
def
test_execute_separate_reasoning
(
self
,
mock_parser_class
):
def
test_execute_separate_reasoning
(
self
,
mock_parser_class
):
"""Test that _execute_separate_reasoning correctly calls the ReasoningParser."""
"""Test that _execute_separate_reasoning correctly calls the ReasoningParser."""
# Setup mock parser
# Setup mock parser
...
@@ -136,7 +136,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
...
@@ -136,7 +136,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
# Verify that the text was updated
# Verify that the text was updated
self
.
assertEqual
(
executor
.
text_
,
f
"[NORMAL from deepseek-r1]:
{
var_value
}
"
)
self
.
assertEqual
(
executor
.
text_
,
f
"[NORMAL from deepseek-r1]:
{
var_value
}
"
)
@
patch
(
"sglang.srt.reasoning_parser.ReasoningParser"
)
@
patch
(
"sglang.srt.
parser.
reasoning_parser.ReasoningParser"
)
def
test_reasoning_parser_integration
(
self
,
mock_parser_class
):
def
test_reasoning_parser_integration
(
self
,
mock_parser_class
):
"""Test the integration between separate_reasoning and ReasoningParser."""
"""Test the integration between separate_reasoning and ReasoningParser."""
# Setup mock parsers for different model types
# Setup mock parsers for different model types
...
@@ -167,7 +167,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
...
@@ -167,7 +167,7 @@ class TestSeparateReasoningExecution(CustomTestCase):
self
.
assertEqual
(
reasoning
,
f
"[REASONING from qwen3]:
{
test_text
}
"
)
self
.
assertEqual
(
reasoning
,
f
"[REASONING from qwen3]:
{
test_text
}
"
)
self
.
assertEqual
(
normal_text
,
f
"[NORMAL from qwen3]:
{
test_text
}
"
)
self
.
assertEqual
(
normal_text
,
f
"[NORMAL from qwen3]:
{
test_text
}
"
)
@
patch
(
"sglang.srt.reasoning_parser.ReasoningParser"
)
@
patch
(
"sglang.srt.
parser.
reasoning_parser.ReasoningParser"
)
def
test_reasoning_parser_invalid_model
(
self
,
mock_parser_class
):
def
test_reasoning_parser_invalid_model
(
self
,
mock_parser_class
):
"""Test that ReasoningParser raises an error for invalid model types."""
"""Test that ReasoningParser raises an error for invalid model types."""
...
...
test/srt/test_harmony_parser.py
View file @
60e37f80
import
unittest
import
unittest
from
sglang.srt.harmony_parser
import
(
from
sglang.srt.
parser.
harmony_parser
import
(
CanonicalStrategy
,
CanonicalStrategy
,
Event
,
Event
,
HarmonyParser
,
HarmonyParser
,
...
...
test/srt/test_jinja_template_utils.py
View file @
60e37f80
...
@@ -4,7 +4,7 @@ Unit tests for Jinja chat template utils.
...
@@ -4,7 +4,7 @@ Unit tests for Jinja chat template utils.
import
unittest
import
unittest
from
sglang.srt.jinja_template_utils
import
(
from
sglang.srt.
parser.
jinja_template_utils
import
(
detect_jinja_template_content_format
,
detect_jinja_template_content_format
,
process_content_for_template_format
,
process_content_for_template_format
,
)
)
...
...
test/srt/test_reasoning_parser.py
View file @
60e37f80
import
unittest
import
unittest
from
sglang.srt.reasoning_parser
import
(
from
sglang.srt.
parser.
reasoning_parser
import
(
BaseReasoningFormatDetector
,
BaseReasoningFormatDetector
,
DeepSeekR1Detector
,
DeepSeekR1Detector
,
KimiDetector
,
KimiDetector
,
...
...
test/srt/test_vlm_accuracy.py
View file @
60e37f80
...
@@ -13,7 +13,6 @@ from PIL import Image
...
@@ -13,7 +13,6 @@ from PIL import Image
from
transformers
import
AutoModel
,
AutoProcessor
,
AutoTokenizer
from
transformers
import
AutoModel
,
AutoProcessor
,
AutoTokenizer
from
sglang.srt.configs.model_config
import
ModelConfig
from
sglang.srt.configs.model_config
import
ModelConfig
from
sglang.srt.conversation
import
generate_chat_conv
from
sglang.srt.entrypoints.openai.protocol
import
ChatCompletionRequest
from
sglang.srt.entrypoints.openai.protocol
import
ChatCompletionRequest
from
sglang.srt.managers.mm_utils
import
embed_mm_inputs
,
init_embedding_cache
from
sglang.srt.managers.mm_utils
import
embed_mm_inputs
,
init_embedding_cache
from
sglang.srt.managers.schedule_batch
import
(
from
sglang.srt.managers.schedule_batch
import
(
...
@@ -23,6 +22,7 @@ from sglang.srt.managers.schedule_batch import (
...
@@ -23,6 +22,7 @@ from sglang.srt.managers.schedule_batch import (
)
)
from
sglang.srt.model_executor.model_runner
import
ModelRunner
from
sglang.srt.model_executor.model_runner
import
ModelRunner
from
sglang.srt.multimodal.processors.base_processor
import
BaseMultimodalProcessor
from
sglang.srt.multimodal.processors.base_processor
import
BaseMultimodalProcessor
from
sglang.srt.parser.conversation
import
generate_chat_conv
from
sglang.srt.server_args
import
ServerArgs
from
sglang.srt.server_args
import
ServerArgs
...
...
test/srt/test_vlm_input_format.py
View file @
60e37f80
...
@@ -14,8 +14,8 @@ from transformers import (
...
@@ -14,8 +14,8 @@ from transformers import (
)
)
from
sglang
import
Engine
from
sglang
import
Engine
from
sglang.srt.conversation
import
generate_chat_conv
from
sglang.srt.entrypoints.openai.protocol
import
ChatCompletionRequest
from
sglang.srt.entrypoints.openai.protocol
import
ChatCompletionRequest
from
sglang.srt.parser.conversation
import
generate_chat_conv
TEST_IMAGE_URL
=
"https://github.com/sgl-project/sglang/blob/main/test/lang/example_image.png?raw=true"
TEST_IMAGE_URL
=
"https://github.com/sgl-project/sglang/blob/main/test/lang/example_image.png?raw=true"
...
...
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