Commit e7976f4
committed
feat(mtmd): improve fallback chat template for multimodal models
- Add BOS/EOS token handling to the default MTMD chat format.
- Use a clearer role-based template with explicit USER and ASSISTANT prefixes.
- Append a newline after each message to keep generated prompts readable.
- Treat EOS as the end marker for the serialized conversation history before
the optional generation prompt.
- Improve fallback behavior for multimodal GGUF models that do not provide a
chat template, such as OCR-oriented models like DeepSeek-OCR 1/2.
- Make the default system prompt a single normalized string while preserving
its original meaning.
- Clean up minor formatting around MTMD context parameter initialization.
This improves prompt compatibility for multimodal models that either lack a
GGUF chat template or are not yet covered by a complete custom chat handler.
Signed-off-by: JamePeng <jame_peng@sina.com>1 parent 69e740c commit e7976f4
1 file changed
Lines changed: 15 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2811 | 2811 | | |
2812 | 2812 | | |
2813 | 2813 | | |
2814 | | - | |
2815 | | - | |
| 2814 | + | |
| 2815 | + | |
2816 | 2816 | | |
2817 | 2817 | | |
2818 | 2818 | | |
| 2819 | + | |
2819 | 2820 | | |
2820 | 2821 | | |
2821 | 2822 | | |
2822 | | - | |
2823 | | - | |
2824 | | - | |
| 2823 | + | |
| 2824 | + | |
2825 | 2825 | | |
2826 | | - | |
| 2826 | + | |
2827 | 2827 | | |
2828 | | - | |
2829 | 2828 | | |
2830 | 2829 | | |
2831 | 2830 | | |
| |||
2842 | 2841 | | |
2843 | 2842 | | |
2844 | 2843 | | |
2845 | | - | |
2846 | 2844 | | |
2847 | | - | |
2848 | | - | |
| 2845 | + | |
| 2846 | + | |
2849 | 2847 | | |
| 2848 | + | |
2850 | 2849 | | |
2851 | 2850 | | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
2852 | 2855 | | |
2853 | | - | |
| 2856 | + | |
2854 | 2857 | | |
2855 | 2858 | | |
2856 | 2859 | | |
| |||
2906 | 2909 | | |
2907 | 2910 | | |
2908 | 2911 | | |
2909 | | - | |
| 2912 | + | |
2910 | 2913 | | |
2911 | 2914 | | |
2912 | 2915 | | |
| |||
0 commit comments