[Bugfix][Frontend] Honor the constructor chat template in offline scoring (#61990)

Signed-off-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com>
Co-authored-by: mottopanikeiku <176798723+mottopanikeiku@users.noreply.github.com>
This commit is contained in:
alp
2026-10-16 10:20:46 +00:00
committed by GitHub
co-authored by mottopanikeiku
parent 024c5188bf
commit 4ab99ff136
4 changed files with 55 additions and 4 deletions
+2 -2
View File
@@ -325,8 +325,8 @@ class PoolingOfflineMixin(OfflineInferenceMixin):
it is used to create the progress bar.
If `False`, no progress bar is created.
lora_request: LoRA request to use for generation, if any.
chat_template: The chat template to use for the scoring. If None, we
use the model's default chat template.
chat_template: The chat template to use for scoring. If None, use
the chat template passed to the LLM constructor.
tokenization_kwargs: Overrides for `tokenizer.encode`.
Returns:
@@ -548,7 +548,11 @@ class CrossEncoderIOProcessor(ScoringIOProcessor):
yield ScoringRenderParams(
data_1=data_1[i],
data_2=data_2[i],
chat_template=ctx.chat_template,
chat_template=(
self.chat_template
if ctx.chat_template is None
else ctx.chat_template
),
max_tokens_per_query=max_tokens_per_query,
max_tokens_per_doc=max_tokens_per_doc,
tok_params=tok_params,