mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-03 03:31:05 +06:00
Fix for tokenizer.apply_chat_template with continue_final_message=True (#34214)
* Strip final message * Do full strip instead of rstrip * Retrigger CI --------- Co-authored-by: Matt <rocketknight1@gmail.com>
This commit is contained in:
parent
b57c7bce21
commit
f2846ad2b7
@ -1874,7 +1874,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
|
||||
**template_kwargs,
|
||||
)
|
||||
if continue_final_message:
|
||||
final_message = chat[-1]["content"]
|
||||
final_message = chat[-1]["content"].strip()
|
||||
rendered_chat = rendered_chat[: rendered_chat.rindex(final_message) + len(final_message)].rstrip()
|
||||
rendered.append(rendered_chat)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user