From 501e7d8a8f4e5dd5f49ffb72fb583bb555595f6f Mon Sep 17 00:00:00 2001 From: Akshat Sehgal <34078596+akshatsehgal@users.noreply.github.com> Date: Mon, 26 May 2025 04:47:54 -0700 Subject: [PATCH] feat: add smollm support (#8050) --- src/llamafactory/data/template.py | 15 +++++++++++++++ src/llamafactory/extras/constants.py | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 74faea46..f88d60bb 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -1684,6 +1684,21 @@ register_template( ) +register_template( + name="smollm", + format_system=StringFormatter( + slots=["<|im_start|>system\n{{content}}<|im_end|>\n"] + ), + format_user=StringFormatter( + slots=["<|im_start|>user\n{{content}}<|im_end|>\n"] + ), + format_assistant=StringFormatter( + slots=["<|im_start|>assistant\n{{content}}<|im_end|>\n"] + ), + stop_words=["<|im_end|>"], +) + + register_template( name="solar", format_user=StringFormatter(slots=["### User:\n{{content}}\n\n### Assistant:\n"]), diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index 5dc7c3f3..b06da885 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -2719,6 +2719,25 @@ register_model_group( ) +register_model_group( + models={ + "SmolLM-135M-Instruct": { + DownloadSource.DEFAULT: "HuggingFaceTB/SmolLM-135M-Instruct", + DownloadSource.MODELSCOPE: "HuggingFaceTB/SmolLM-135M-Instruct", + }, + "SmolLM-360M-Instruct": { + DownloadSource.DEFAULT: "HuggingFaceTB/SmolLM-360M-Instruct", + DownloadSource.MODELSCOPE: "HuggingFaceTB/SmolLM-360M-Instruct", + }, + "SmolLM-1.7B-Instruct": { + DownloadSource.DEFAULT: "HuggingFaceTB/SmolLM-1.7B-Instruct", + DownloadSource.MODELSCOPE: "HuggingFaceTB/SmolLM-1.7B-Instruct", + }, + }, + template="smollm", +) + + register_model_group( models={ "SOLAR-10.7B-v1.0": {