Commit 265f3d6
committed
FIX: handle empty chat_template in multimodal chat engines
- VLLMMultiModel: fall back to tokenizer's chat_template when model_family.chat_template is empty
- SGLANGVisionModel: same logic as VLLMMultiModel, align with MLX core behavior
- SGLANGModel: use empty string instead of asserting when chat_template is empty
When chat_template is empty, engines will:
1. Get tokenizer and retrieve its chat_template attribute
2. If still empty, raise ValueError
3. Pass tokenizer to get_full_context for proper template application
This aligns the behavior across vllm, sglang, and mlx engines.1 parent 06d9f28 commit 265f3d6
2 files changed
Lines changed: 33 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
720 | 723 | | |
721 | 724 | | |
722 | 725 | | |
| |||
736 | 739 | | |
737 | 740 | | |
738 | 741 | | |
739 | | - | |
| 742 | + | |
740 | 743 | | |
741 | 744 | | |
742 | 745 | | |
| |||
822 | 825 | | |
823 | 826 | | |
824 | 827 | | |
825 | | - | |
826 | | - | |
827 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
828 | 839 | | |
829 | 840 | | |
830 | 841 | | |
| |||
833 | 844 | | |
834 | 845 | | |
835 | 846 | | |
836 | | - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
837 | 850 | | |
838 | 851 | | |
839 | 852 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1976 | 1976 | | |
1977 | 1977 | | |
1978 | 1978 | | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
1979 | 1992 | | |
1980 | 1993 | | |
1981 | 1994 | | |
| |||
1988 | 2001 | | |
1989 | 2002 | | |
1990 | 2003 | | |
1991 | | - | |
| 2004 | + | |
1992 | 2005 | | |
1993 | 2006 | | |
1994 | 2007 | | |
| |||
0 commit comments