A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 3, 15:15 UTC
[Bugfix] Fix incorrect chat template format for Qwen3.5 (#42660)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Cyrus Leung committed
May 15, 2026 at 11:52 UTC
56434e86512a0ef035ab3d9c4de84a71c29d20fd
2 files changed
+6
tests/renderers/test_hf.py
+1
@@ -363,6 +363,7 @@ def test_resolve_chat_template_kwargs_with_template_name():
363
("microsoft/Phi-3.5-vision-instruct", "string"),
364
("Qwen/Qwen2-VL-2B-Instruct", "openai"),
365
("Qwen/Qwen2.5-VL-3B-Instruct", "openai"),
366
+ ("Qwen/Qwen3.5-4B", "openai"),
367
("fixie-ai/ultravox-v0_5-llama-3_2-1b", "string"),
368
("Qwen/Qwen2-Audio-7B-Instruct", "openai"),
369
("meta-llama/Llama-Guard-3-1B", "openai"),
vllm/renderers/hf.py
+5
@@ -402,6 +402,7 @@ def _iter_nodes_assign_content_item(root: jinja2.nodes.Node):
402
]
403
404
# Search for {%- for content in message['content'] -%} loops
405
+ # or {%- for item in content -%} loops
406
for loop_ast in root.find_all(jinja2.nodes.For):
407
loop_iter = loop_ast.iter
408
loop_target = loop_ast.target
@@ -412,6 +413,10 @@ def _iter_nodes_assign_content_item(root: jinja2.nodes.Node):
413
yield loop_ast, loop_target.name
414
break
415
416
+ if isinstance(loop_iter, jinja2.nodes.Name) and loop_iter.name == "content":
417
+ assert isinstance(loop_target, jinja2.nodes.Name)
418
+ yield loop_ast, loop_target.name
419
+
420
421
def _try_extract_ast(chat_template: str) -> jinja2.nodes.Template | None:
422
import transformers.utils.chat_template_utils as hf_chat_utils