model: support deepseek-ocr (#11891)

Co-authored-by: yhyang201 <47235274+yhyang201@users.noreply.github.com>
Co-authored-by: yhyang201 <yhyang201@gmail.com>
Co-authored-by: Shi Shuai <126407087+shuaills@users.noreply.github.com>
Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
Mick
2025-10-24 03:15:17 +08:00
committed by GitHub
parent 39c237f02c
commit 770529a731
13 changed files with 2125 additions and 117 deletions

View File

@@ -838,6 +838,19 @@ register_conv_template(
)
)
register_conv_template(
Conversation(
name="deepseek-ocr",
system_message="",
system_template="",
roles=("", ""),
sep="",
sep_style=SeparatorStyle.NO_COLON_SINGLE,
stop_str=["<end▁of▁sentence>"],
image_token="<image>",
)
)
register_conv_template(
Conversation(
name="deepseek-vl2",
@@ -981,6 +994,7 @@ MODEL_TYPE_TO_TEMPLATE = {
"phi4mm": "phi-4-mm",
"minicpmv": "minicpmv",
"minicpmo": "minicpmo",
"deepseek-ocr": "deepseek-ocr",
}
@@ -1057,3 +1071,11 @@ def match_phi_4_mm(model_path: str):
return "phi-4-mm"
model_type = get_model_type(model_path)
return MODEL_TYPE_TO_TEMPLATE.get(model_type)
@register_conv_template_matching_function
def match_deepseek_ocr(model_path: str):
if "deepseek-ocr" in model_path.lower():
return "deepseek-ocr"
model_type = get_model_type(model_path)
return MODEL_TYPE_TO_TEMPLATE.get(model_type)