diff --git a/modelscope/preprocessors/templates/loader.py b/modelscope/preprocessors/templates/loader.py index 66029de4..23ca01bc 100644 --- a/modelscope/preprocessors/templates/loader.py +++ b/modelscope/preprocessors/templates/loader.py @@ -255,6 +255,12 @@ template_info = [ modelfile_prefix= 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/phi3', ), + TemplateInfo( + template_regex= + f'.*{cases("phi4", "phi-4")}{no_multi_modal()}.*', + modelfile_prefix= + 'https://modelscope.oss-cn-beijing.aliyuncs.com/llm_template/ollama/phi4', + ), TemplateInfo( template_regex= f'.*{cases("phi")}{no_multi_modal()}.*', diff --git a/tests/tools/test_to_ollama.py b/tests/tools/test_to_ollama.py index 1abfc842..9e374468 100644 --- a/tests/tools/test_to_ollama.py +++ b/tests/tools/test_to_ollama.py @@ -365,6 +365,10 @@ class TestToOllama(unittest.TestCase): 'bartowski/Dolphin3.0-Llama3.1-8B-GGUF', 'dolphin3', gguf_meta={'general.name': 'Dolphin 3.0 Llama 3.1 8B'}) + _test_check_tmpl_type( + 'AI-ModelScope/phi-4', + 'phi4', + gguf_meta={'general.name': 'Phi 4'}) if __name__ == '__main__':