apply_chat_template: consistent behaviour for return_assistant_tokens_mask=True return_tensors=True#35582
Merged
ArthurZucker merged 4 commits intohuggingface:mainfrom Feb 4, 2025
Conversation
406d7bf to
d79b446
Compare
…assistant_tokens_mask flag
…ith no attention mask
… no padding token
eb47736 to
7349d16
Compare
Contributor
Author
|
Hi! Take a look, please |
Member
|
Hi @mrsndmn, I'm sorry we missed this PR! @yonigottesman can you take a look? It's okay if you don't have time - just let me know and I can take it instead |
Contributor
Author
|
Hey @yonigottesman, just checking in — did you have a chance to look at this PR? No rush, but let me know if you need anything from me! |
ArthurZucker
approved these changes
Feb 4, 2025
Collaborator
ArthurZucker
left a comment
There was a problem hiding this comment.
LGTM let's merge 🤗
elvircrn
pushed a commit
to elvircrn/transformers
that referenced
this pull request
Feb 13, 2025
…_mask=True return_tensors=True (huggingface#35582) * apply_chat_template: consistent return_tensors behaviour with return_assistant_tokens_mask flag * test_chat_template_return_assistant_tokens_mask: support tokenizers with no attention mask * test_chat_template_return_assistant_tokens_mask: skip tokenizers with no padding token * test_chat_template_return_assistant_tokens_mask: force tokenizer padding_side=right --------- Co-authored-by: Eduard Allakhverdov <goncharova@airi.net> Co-authored-by: d.tarasov <d.tarasov@airi.net>
sbucaille
pushed a commit
to sbucaille/transformers
that referenced
this pull request
Feb 16, 2025
…_mask=True return_tensors=True (huggingface#35582) * apply_chat_template: consistent return_tensors behaviour with return_assistant_tokens_mask flag * test_chat_template_return_assistant_tokens_mask: support tokenizers with no attention mask * test_chat_template_return_assistant_tokens_mask: skip tokenizers with no padding token * test_chat_template_return_assistant_tokens_mask: force tokenizer padding_side=right --------- Co-authored-by: Eduard Allakhverdov <goncharova@airi.net> Co-authored-by: d.tarasov <d.tarasov@airi.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR fixes the simultaneous use of flags
return_assistant_tokens_mask,return_tensors, inapply_chat_templatemethod.Is related to #28950 and corresponding PR #30650
Before fix
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@yonigottesman @amyeroberts @Rocketknight1