diff --git a/modelscope/preprocessors/templates/loader.py b/modelscope/preprocessors/templates/loader.py index 51e2401d..f9c8f944 100644 --- a/modelscope/preprocessors/templates/loader.py +++ b/modelscope/preprocessors/templates/loader.py @@ -208,6 +208,12 @@ template_info = [ ), # qwen + TemplateInfo( + template_regex=f'.*{cases("qwen3")}.*{cases("coder")}.*', + modelfile_prefix= + 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/qwen3-coder', + allow_general_name=False, + ), TemplateInfo( template_regex=f'.*{cases("qwen3")}{no_multi_modal()}.*', modelfile_prefix= @@ -255,6 +261,13 @@ template_info = [ ), # gemma + TemplateInfo( + template=TemplateType.gemma, + template_regex= + f'{no("pali")}.*{cases("gemma")}.*{cases("3n")}.*', + modelfile_prefix= + 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/gemma3n', + ), TemplateInfo( template_regex= f'.*{cases("codegemma")}.*', @@ -365,6 +378,12 @@ template_info = [ modelfile_prefix= 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/yarn-mistral', ), + TemplateInfo( + template_regex= + f'.*{cases("mistral")}.*{cases("small3.2", "small-3.2")}.*', + modelfile_prefix= + 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/mistral-small3.2', + ), TemplateInfo( template_regex= f'.*{cases("mistral")}.*{cases("small3.1", "small-3.1")}.*', @@ -595,6 +614,22 @@ template_info = [ 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/wizardlm', ), + # magistral + TemplateInfo( + template_regex= + f'.*{cases("magistral")}.*', + modelfile_prefix= + 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/magistral', + ), + + # devstral + TemplateInfo( + template_regex= + f'.*{cases("devstral")}.*', + modelfile_prefix= + 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/devstral', + ), + # vicuna TemplateInfo( template_regex= diff --git a/tests/tools/test_to_ollama.py b/tests/tools/test_to_ollama.py index 21cb8ebf..274fd56d 100644 --- a/tests/tools/test_to_ollama.py +++ b/tests/tools/test_to_ollama.py @@ -122,6 +122,24 @@ class TestToOllama(unittest.TestCase): @unittest.skipUnless(test_level() >= 0, 'skip test in current test level') def test_check_template_type(self): + _test_check_tmpl_type('unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF', + 'qwen3-coder') + _test_check_tmpl_type( + 'unsloth/gemma-3n-E4B-it-GGUF', + 'gemma3n', + gguf_meta={'general.name': 'Gemma-3N-E4B-It'}) + _test_check_tmpl_type( + 'unsloth/Mistral-Small-3.2-24B-Instruct-2506-GGUF', + 'mistral-small3.2', + gguf_meta={'general.name': 'Mistral-Small-3.2-24B-Instruct-2506'}) + _test_check_tmpl_type( + 'unsloth/Magistral-Small-2507-GGUF', + 'magistral', + gguf_meta={'general.name': 'Magistral-Small-2507'}) + _test_check_tmpl_type( + 'mistralai/Devstral-Small-2507_gguf', + 'devstral', + gguf_meta={'general.name': 'devstral-small-2507'}) _test_check_tmpl_type( 'unsloth/DeepSeek-R1-0528-Qwen3-8B-GGUF', 'deepseek-r1',