model: support DeepSeek-OCR-2 (#17897)

This commit is contained in:
baonudesifeizhai
2026-01-30 09:49:51 +08:00
committed by GitHub
parent 2cd2c3118d
commit 84ab611af8
9 changed files with 620 additions and 142 deletions
@@ -12,6 +12,14 @@ class DeepseekOCRProcessor(BaseMultimodalProcessor):
def __init__(self, hf_config, server_args, _processor, *args, **kwargs):
_processor.image_size = 640
_processor.ocr2_mode = (
str(
getattr(getattr(hf_config, "vision_config", None), "model_name", "")
).lower()
== "deepencoderv2"
or getattr(getattr(hf_config, "projector_config", None), "input_dim", None)
== 896
)
super().__init__(hf_config, server_args, _processor, *args, **kwargs)
self.mm_tokens = MultimodalSpecialTokens(
image_token="<image>", image_token_id=self._processor.image_token_id