From 15bba157259a7fdff88bb0b2556803ea28e9ba95 Mon Sep 17 00:00:00 2001 From: Zhangchi Feng <64362896+BUAADreamer@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:46:48 +0800 Subject: [PATCH] Fix template name of MiniCPM-V (#6620) * fix template name * tiny fix Former-commit-id: 3077f20339158564009270edf79c8ef1b10e8b4a --- README.md | 2 +- README_zh.md | 2 +- src/llamafactory/data/mm_plugin.py | 4 ++-- src/llamafactory/data/template.py | 4 ++-- src/llamafactory/extras/constants.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7b70a89a..be019fa9 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/ | [LLaVA-NeXT](https://huggingface.co/llava-hf) | 7B/8B/13B/34B/72B/110B | llava_next | | [LLaVA-NeXT-Video](https://huggingface.co/llava-hf) | 7B/34B | llava_next_video | | [MiniCPM](https://huggingface.co/openbmb) | 1B/2B/4B | cpm/cpm3 | -| [MiniCPM-V-2.6](https://huggingface.co/openbmb) | 8B | cpm_o | +| [MiniCPM-V-2.6](https://huggingface.co/openbmb) | 8B | cpm_v | | [Mistral/Mixtral](https://huggingface.co/mistralai) | 7B/8x7B/8x22B | mistral | | [OLMo](https://huggingface.co/allenai) | 1B/7B | - | | [PaliGemma/PaliGemma2](https://huggingface.co/google) | 3B/10B/28B | paligemma | diff --git a/README_zh.md b/README_zh.md index 80903fcb..50ec1acc 100644 --- a/README_zh.md +++ b/README_zh.md @@ -210,7 +210,7 @@ https://github.com/user-attachments/assets/e6ce34b0-52d5-4f3e-a830-592106c4c272 | [LLaVA-NeXT](https://huggingface.co/llava-hf) | 7B/8B/13B/34B/72B/110B | llava_next | | [LLaVA-NeXT-Video](https://huggingface.co/llava-hf) | 7B/34B | llava_next_video | | [MiniCPM](https://huggingface.co/openbmb) | 1B/2B/4B | cpm/cpm3 | -| [MiniCPM-V-2.6](https://huggingface.co/openbmb) | 8B | cpm_o | +| [MiniCPM-V-2.6](https://huggingface.co/openbmb) | 8B | cpm_v | | [Mistral/Mixtral](https://huggingface.co/mistralai) | 7B/8x7B/8x22B | mistral | | [OLMo](https://huggingface.co/allenai) | 1B/7B | - | | [PaliGemma/PaliGemma2](https://huggingface.co/google) | 3B/10B/28B | paligemma | diff --git a/src/llamafactory/data/mm_plugin.py b/src/llamafactory/data/mm_plugin.py index 909ce7c0..435496bb 100644 --- a/src/llamafactory/data/mm_plugin.py +++ b/src/llamafactory/data/mm_plugin.py @@ -254,7 +254,7 @@ class BasePlugin: return {} -class CpmOPlugin(BasePlugin): +class CpmVPlugin(BasePlugin): @override def process_messages( self, @@ -949,7 +949,7 @@ class MllamaPlugin(BasePlugin): PLUGINS = { "base": BasePlugin, - "cpm_o": CpmOPlugin, + "cpm_v": CpmVPlugin, "llava": LlavaPlugin, "llava_next": LlavaNextPlugin, "llava_next_video": LlavaNextVideoPlugin, diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index 58dcf561..60e34a8d 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -567,12 +567,12 @@ _register_template( _register_template( - name="cpm_o", + name="cpm_v", format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), format_assistant=StringFormatter(slots=["{{content}}<|im_end|>\n"]), format_system=StringFormatter(slots=["<|im_start|>system\n{{content}}<|im_end|>\n"]), stop_words=["<|im_end|>"], - mm_plugin=get_mm_plugin(name="cpm_o", image_token="", video_token="