[New Model] Gemma 4 (#21952)

Signed-off-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: Pengyu Chen <pychen96@gmail.com>
Co-authored-by: kpham-sgl <khoa.pham@radixark.ai>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Andy Luo <andy.luo@amd.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: adarshxs <adarsh.shirawalmath@gmail.com>
This commit is contained in:
Xinyuan Tong
2026-04-06 20:24:44 -07:00
committed by GitHub
co-authored by Pengyu Chen kpham-sgl Claude Opus 4.6 Andy Luo gemini-code-assist[bot] adarshxs
parent be0277f9a0
commit 2813cb6d9a
35 changed files with 6007 additions and 70 deletions
+17 -8
View File
@@ -404,6 +404,19 @@ register_chat_template(
)
)
register_chat_template(
ChatTemplate(
name="gemma-4-it",
default_system_prompt=None,
role_prefix_and_suffix={
"system": ("", ""),
"user": ("<|turn>user\n", "<turn|>\n"),
"assistant": ("<|turn>assistant\n", "<turn|>\n"),
},
style=ChatTemplateStyle.PLAIN,
)
)
register_chat_template(
ChatTemplate(
name="dbrx-instruct",
@@ -611,8 +624,10 @@ def match_chat_yi(model_path: str):
@register_chat_template_matching_function
def match_gemma_it(model_path: str):
if re.search(r"gemma.*it", model_path, re.IGNORECASE):
def match_gemma(model_path: str):
if re.search(r"gemma-4.*it", model_path, re.IGNORECASE):
return "gemma-4-it"
if re.search(r"(gemma.*it)|(gemma-3)", model_path, re.IGNORECASE):
return "gemma-it"
@@ -636,12 +651,6 @@ def match_granite_instruct(model_path: str):
return "granite-3-instruct"
@register_chat_template_matching_function
def match_gemma3_instruct(model_path: str):
if re.search(r"gemma-3", model_path, re.IGNORECASE):
return "gemma-it"
@register_chat_template_matching_function
def match_internvl_chat(model_path: str):
if re.search(r"internvl2_5", model_path, re.IGNORECASE):