Skip to content

Commit b31f33e

Browse files
aarnphmYuqi Zhang
authored andcommitted
[Fix] check to make sure processor has chat templates (vllm-project#18047)
Signed-off-by: Aaron Pham <[email protected]> Signed-off-by: Yuqi Zhang <[email protected]>
1 parent dbda63f commit b31f33e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tests/compile/test_pass_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_bad_callable():
2222
pass_manager.configure(config)
2323

2424
with pytest.raises(AssertionError):
25-
pass_manager.add(simple_callable) # noqa, type wrong on purpose
25+
pass_manager.add(simple_callable)
2626

2727

2828
# Pass that inherits from InductorPass

vllm/compilation/inductor_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from torch._inductor.custom_graph_pass import CustomGraphPass
1717
else:
1818
# CustomGraphPass is not present in 2.5 or lower, import our version
19-
from .torch25_custom_graph_pass import ( # noqa: yapf
19+
from .torch25_custom_graph_pass import ( # noqa: E501
2020
Torch25CustomGraphPass as CustomGraphPass)
2121

2222
_pass_context = None

vllm/entrypoints/chat_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ def resolve_hf_chat_template(
349349
trust_remote_code=model_config.trust_remote_code,
350350
)
351351
if isinstance(processor, ProcessorMixin) and \
352+
hasattr(processor, 'chat_template') and \
352353
processor.chat_template is not None:
353354
return processor.chat_template
354355
except Exception:
355-
logger.debug("Failed to load AutoProcessor chat template for %s",
356-
tokenizer.name_or_path, exc_info=True)
356+
logger.debug("Failed to load AutoProcessor chat template for %s", tokenizer.name_or_path, exc_info=True) # noqa: E501
357357

358358
# 3rd priority: AutoTokenizer chat template
359359
try:

0 commit comments

Comments
 (0)