Skip to content

Commit 2f71915

Browse files
authored
[0.34.0-dlc][fix] Fix sync mode vllm rolling batch handler (#2923)
1 parent 362484b commit 2f71915

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

engines/python/setup/djl_python/chat_completions/vllm_chat_utils.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ def _preprocess_chat(
113113
add_special_tokens: bool = False,
114114
) -> Tuple[List[ConversationMessage], RequestPrompt, TokensPrompt, str]:
115115
resolved_content_format = resolve_chat_template_content_format(
116-
chat_template, tool_dicts, chat_template_content_format, tokenizer)
117-
conversation, mm_data = parse_chat_messages(
116+
chat_template,
117+
tool_dicts,
118+
chat_template_content_format,
119+
tokenizer,
120+
model_config=rolling_batch.engine.model_config)
121+
conversation, mm_data, mm_uuids = parse_chat_messages(
118122
messages,
119123
rolling_batch.engine.model_config,
120124
tokenizer,
@@ -134,9 +138,11 @@ def _preprocess_chat(
134138
messages=messages,
135139
**chat_template_kwargs)
136140
else:
137-
request_prompt = apply_hf_chat_template(tokenizer,
138-
conversation=conversation,
139-
**chat_template_kwargs)
141+
request_prompt = apply_hf_chat_template(
142+
tokenizer,
143+
conversation=conversation,
144+
model_config=rolling_batch.engine.model_config,
145+
**chat_template_kwargs)
140146

141147
should_parse_tools = tool_parser is not None and request.tool_choice != "none"
142148
if should_parse_tools:
@@ -162,6 +168,8 @@ def _preprocess_chat(
162168
prompt_token_ids=prompt_inputs["prompt_token_ids"])
163169
if mm_data is not None:
164170
engine_prompt["multi_modal_data"] = mm_data
171+
if mm_uuids is not None:
172+
engine_prompt["multi_modal_uuids"] = mm_uuids
165173
return conversation, request_prompt, engine_prompt, prompt_inputs["prompt"]
166174

167175

0 commit comments

Comments
 (0)