Support new features of MiniCPM-V (#6626)

* fix template name

* tiny fix

* support minicpm-o-2.6
This commit is contained in:
Zhangchi Feng
2025-01-14 00:26:19 +08:00
committed by GitHub
parent e3e2c8c689
commit c3fda5046d
8 changed files with 189 additions and 168 deletions

View File

@@ -576,17 +576,6 @@ _register_template(
)
# copied from chatml template
_register_template(
name="cpm_v",
format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]),
format_assistant=StringFormatter(slots=["{{content}}<|im_end|>\n"]),
format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]),
stop_words=["<|im_end|>"],
mm_plugin=get_mm_plugin(name="cpm_v", image_token="<image>", video_token="<video>"),
)
# copied from chatml template
_register_template(
name="dbrx",
@@ -961,6 +950,17 @@ _register_template(
)
# copied from chatml template
_register_template(
name="minicpm_v",
format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]),
format_assistant=StringFormatter(slots=["{{content}}<|im_end|>\n"]),
format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]),
stop_words=["<|im_end|>"],
mm_plugin=get_mm_plugin(name="minicpm_v", image_token="<image>", video_token="<video>"),
)
_register_template(
name="mistral",
format_user=StringFormatter(slots=["[INST] {{content}}[/INST]"]),