File tree Expand file tree Collapse file tree 6 files changed +26
-31
lines changed Expand file tree Collapse file tree 6 files changed +26
-31
lines changed Original file line number Diff line number Diff line change @@ -71,17 +71,9 @@ def create_processor(self):
71
71
"""
72
72
reasoning_parser_obj = None
73
73
tool_parser_obj = None
74
- try :
75
- from fastdeploy .plugins .reasoning_parser import (
76
- load_reasoning_parser_plugins ,
77
- )
78
74
79
- custom_reasoning_parser = load_reasoning_parser_plugins ()
80
- if self .reasoning_parser == "custom_reasoning_parser" :
81
- reasoning_parser_obj = custom_reasoning_parser
82
- except :
83
- if self .reasoning_parser :
84
- reasoning_parser_obj = ReasoningParserManager .get_reasoning_parser (self .reasoning_parser )
75
+ if self .reasoning_parser :
76
+ reasoning_parser_obj = ReasoningParserManager .get_reasoning_parser (self .reasoning_parser )
85
77
if self .tool_parser :
86
78
tool_parser_obj = ToolParserManager .get_tool_parser (self .tool_parser )
87
79
Original file line number Diff line number Diff line change 23
23
def load_input_processor_plugins ():
24
24
"""load_input_processor_plugins"""
25
25
plugins = load_plugins_by_group (group = PLUGINS_GROUP )
26
- assert len (plugins ) <= 1 , "Most one plugin is allowed to be loaded."
26
+ assert len (plugins ) == 1 , "Only one plugin is allowed to be loaded."
27
27
return next (iter (plugins .values ()))()
Original file line number Diff line number Diff line change 14
14
# limitations under the License.
15
15
"""
16
16
17
- from fastdeploy .plugins .utils import load_plugins_by_group , plugins_loaded
17
+ from fastdeploy .plugins .utils import load_plugins_by_group
18
18
19
19
# use for modle runner
20
20
PLUGINS_GROUP = "fastdeploy.model_runner_plugins"
21
21
22
22
23
23
def load_model_runner_plugins ():
24
24
"""load_model_runner_plugins"""
25
- global plugins_loaded
26
- if plugins_loaded :
27
- return
28
- plugins_loaded = True
29
-
30
25
plugins = load_plugins_by_group (group = PLUGINS_GROUP )
31
- assert len (plugins ) <= 1 , "Most one plugin is allowed to be loaded."
26
+ assert len (plugins ) == 1 , "Only one plugin is allowed to be loaded."
32
27
return next (iter (plugins .values ()))()
Original file line number Diff line number Diff line change 14
14
# limitations under the License.
15
15
"""
16
16
17
- from fastdeploy .plugins .utils import load_plugins_by_group
17
+ from fastdeploy .plugins .utils import load_plugins_by_group , plugins_loaded
18
18
19
19
# make sure one process only loads plugins once
20
20
PLUGINS_GROUP = "fastdeploy.reasoning_parser_plugins"
21
21
22
22
23
23
def load_reasoning_parser_plugins ():
24
24
"""load_reasoning_parser_plugins"""
25
+ global plugins_loaded
26
+ if plugins_loaded :
27
+ return
28
+ plugins_loaded = True
29
+
25
30
plugins = load_plugins_by_group (group = PLUGINS_GROUP )
26
- assert len (plugins ) <= 1 , "Most one plugin is allowed to be loaded."
27
- return next (iter (plugins .values ()))()
31
+ # general plugins, we only need to execute the loaded functions
32
+ for func in plugins .values ():
33
+ func ()
Original file line number Diff line number Diff line change 14
14
# limitations under the License.
15
15
"""
16
16
17
+ from fastdeploy .plugins import load_reasoning_parser_plugins
18
+
17
19
from .abs_reasoning_parsers import ReasoningParser , ReasoningParserManager
18
20
from .ernie_vl_reasoning_parsers import ErnieVLReasoningParser
19
21
from .ernie_x1_reasoning_parsers import ErnieX1ReasoningParser
26
28
"Qwen3ReasoningParser" ,
27
29
"ErnieX1ReasoningParser" ,
28
30
]
31
+
32
+ load_reasoning_parser_plugins ()
Original file line number Diff line number Diff line change
1
+ """
1
2
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
2
- #
3
- #
4
- from collections .abc import Sequence
5
- from typing import Tuple , Union
6
-
7
- from fastdeploy .entrypoints .openai .protocol import ChatCompletionRequest , DeltaMessage
8
- from fastdeploy .reasoning import ReasoningParser , ReasoningParserManager
9
-
10
- #
11
- #
12
3
# Licensed under the Apache License, Version 2.0 (the "License"
13
4
# you may not use this file except in compliance with the License.
14
5
# You may obtain a copy of the License at
20
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
12
# See the License for the specific language governing permissions and
22
13
# limitations under the License.
14
+ """
15
+
16
+ from collections .abc import Sequence
17
+ from typing import Tuple , Union
18
+
19
+ from fastdeploy .entrypoints .openai .protocol import ChatCompletionRequest , DeltaMessage
20
+ from fastdeploy .reasoning import ReasoningParser , ReasoningParserManager
23
21
24
22
25
23
@ReasoningParserManager .register_module ("ernie_x1" )
You can’t perform that action at this time.
0 commit comments