Skip to content
Closed
19 changes: 15 additions & 4 deletions fastdeploy/input/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def create_processor(self):
reasoning_parser_obj = ReasoningParserManager.get_reasoning_parser(self.reasoning_parser)
if self.tool_parser:
tool_parser_obj = ToolParserManager.get_tool_parser(self.tool_parser)
architectures = ModelConfig({"model": self.model_name_or_path}).architectures[0]

config = ModelConfig({"model": self.model_name_or_path})
architectures = config.architectures[0]

if not self.enable_mm:
if not ErnieArchitectures.contains_ernie_arch(architectures):
from fastdeploy.input.text_processor import DataProcessor
Expand All @@ -95,9 +98,7 @@ def create_processor(self):
tool_parser_obj=tool_parser_obj,
)
else:
if not ErnieArchitectures.contains_ernie_arch(architectures):
raise ValueError(f"Model {self.model_name_or_path} is not a valid Ernie4_5_VL model.")
else:
if ErnieArchitectures.contains_ernie_arch(architectures):
from fastdeploy.input.ernie_vl_processor import ErnieMoEVLProcessor

self.processor = ErnieMoEVLProcessor(
Expand All @@ -107,4 +108,14 @@ def create_processor(self):
reasoning_parser_obj=reasoning_parser_obj,
tool_parser_obj=tool_parser_obj,
)
else:
from fastdeploy.input.qwen_vl_processor import QwenVLProcessor

self.processor = QwenVLProcessor(
config=config,
model_name_or_path=self.model_name_or_path,
limit_mm_per_prompt=self.limit_mm_per_prompt,
mm_processor_kwargs=self.mm_processor_kwargs,
reasoning_parser_obj=reasoning_parser_obj,
)
return self.processor
22 changes: 22 additions & 0 deletions fastdeploy/input/qwen_mm_processor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""

from .process import IDS_TYPE_FLAG, DataProcessor

__all__ = [
"DataProcessor",
"IDS_TYPE_FLAG",
]
Loading
Loading