Repository navigation
Conversation
Calling .keys() on a list raised AttributeError (huggingface#47110). Route list/tuple payloads to extra_special_tokens (unnamed specials) and keep dict handling for named model-specific tokens. Raise a clear TypeError for other types. Closes huggingface#47110 Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Contributor
|
Thank you for your contribution 🤗! CI Security Gate — automatic approval blockedThis PR was not automatically approved for CI because the security gate failed. Possible reasons:
See the workflow run for the exact violations. A maintainer can review and manually approve CI if a finding is a false positive. |
Member
|
@SebTardif hey, cool off on the random agent PRs! Users running code agents against random issues just spams the maintainers. If we want an agent to fix any of these, we can run it ourselves. If you're an existing contributor and you want to use a code agent to diagnose or fix an issue you've encountered, that's fine, but we don't need people to just run these things randomly. |
4 tasks
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?
Fixes #47110:
_set_model_specific_special_tokenscrashed with'list' object has no attribute 'keys'when given a legacy list of special token strings.Problem
assumes
special_tokensis always a dict of{name: value}. Legacy payloads (and some callers) pass a bare list such as['<s>NOTUSED', '</s>NOTUSED', '<unk>NOTUSED'], which has no.keys().Prior attempt #47132 only raised a clearer
TypeErrorfor non-dicts (still fails to load) and was closed after CI failures. This PR makes list payloads work by routing them toextra_special_tokens(unnamed specials), which is the V5 home for list-shaped special token data.Fix
list/tuple: append tokens to_extra_special_tokens(deduped by string form) and returndict: existing named-token behaviorTypeErrorTest
Origin: Named model-specific specials API from #34461 (2024-11-04).
Before submitting
Who can review?
@ArthurZucker @itazap (tokenizers)