mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[DataProcessor] Move image_processor to unified directory and add MultiModalProcessor (#7109)
* first commit * step 9~10 * update multimodal * update multimodal * fix load tokenizer * add unit test * fix unit test & AdaptiveImageProcessor * Delete unused code
This commit is contained in:
@@ -91,54 +91,34 @@ class InputPreprocessor:
|
||||
tool_parser_obj=tool_parser_obj,
|
||||
)
|
||||
else:
|
||||
from fastdeploy.input.multimodal_processor import (
|
||||
ERNIE4_5_VL,
|
||||
PADDLEOCR_VL,
|
||||
QWEN3_VL,
|
||||
QWEN_VL,
|
||||
MultiModalProcessor,
|
||||
)
|
||||
|
||||
if ErnieArchitectures.contains_ernie_arch(architecture):
|
||||
from fastdeploy.input.ernie4_5_vl_processor import (
|
||||
Ernie4_5_VLProcessor,
|
||||
)
|
||||
|
||||
self.processor = Ernie4_5_VLProcessor(
|
||||
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,
|
||||
tool_parser_obj=tool_parser_obj,
|
||||
enable_processor_cache=self.enable_processor_cache,
|
||||
)
|
||||
model_type = ERNIE4_5_VL
|
||||
elif "PaddleOCRVL" in architecture:
|
||||
from fastdeploy.input.paddleocr_vl_processor import (
|
||||
PaddleOCRVLProcessor,
|
||||
)
|
||||
|
||||
self.processor = PaddleOCRVLProcessor(
|
||||
config=self.model_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,
|
||||
)
|
||||
model_type = PADDLEOCR_VL
|
||||
elif "Qwen2_5_VL" in architecture:
|
||||
from fastdeploy.input.qwen_vl_processor import QwenVLProcessor
|
||||
|
||||
self.processor = QwenVLProcessor(
|
||||
config=self.model_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,
|
||||
enable_processor_cache=self.enable_processor_cache,
|
||||
)
|
||||
model_type = QWEN_VL
|
||||
elif "Qwen3VL" in architecture:
|
||||
from fastdeploy.input.qwen3_vl_processor import Qwen3VLProcessor
|
||||
|
||||
self.processor = Qwen3VLProcessor(
|
||||
config=self.model_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,
|
||||
enable_processor_cache=self.enable_processor_cache,
|
||||
)
|
||||
model_type = QWEN3_VL
|
||||
else:
|
||||
raise ValueError(f"Unsupported model processor architecture: {architecture}. ")
|
||||
|
||||
self.processor = MultiModalProcessor(
|
||||
model_name_or_path=self.model_name_or_path,
|
||||
model_type=model_type,
|
||||
config=self.model_config,
|
||||
limit_mm_per_prompt=self.limit_mm_per_prompt,
|
||||
mm_processor_kwargs=self.mm_processor_kwargs,
|
||||
reasoning_parser_obj=reasoning_parser_obj,
|
||||
tool_parser_obj=tool_parser_obj,
|
||||
enable_processor_cache=self.enable_processor_cache,
|
||||
)
|
||||
|
||||
return self.processor
|
||||
|
||||
Reference in New Issue
Block a user