model: Support Janus-pro (#3203)

This commit is contained in:
Mick
2025-03-13 02:02:11 +08:00
committed by GitHub
parent 6f43a9b9f4
commit 01090e8ac3
13 changed files with 2957 additions and 15 deletions

View File

@@ -230,6 +230,29 @@ register_chat_template(
)
)
register_chat_template(
ChatTemplate(
name="janus-pro",
default_system_prompt=None,
role_prefix_and_suffix={
"system": (
"",
"",
),
"User": (
"<User>",
"",
),
"assistant": (
"<Assistant>",
"<end▁of▁sentence>",
),
},
stop_str=("<end▁of▁sentence>",),
image_token="<image_placeholder>\n",
)
)
# The difference between "llama-3-instruct-llava" and "llama-3-instruct" is that llava uses a different image_token.
register_chat_template(
ChatTemplate(
@@ -384,6 +407,12 @@ def match_deepseek(model_path: str):
return get_chat_template("deepseek-v3")
@register_chat_template_matching_function
def match_deepseek_janus_pro(model_path: str):
if "janus" in model_path.lower():
return get_chat_template("janus-pro")
@register_chat_template_matching_function
def match_dbrx(model_path: str):
if "dbrx" in model_path.lower() and "instruct" in model_path.lower():