Skip to content

Fix AddedToken duplicate 'special' kwarg for extra_special_tokens#44313

Closed
jashshah999 wants to merge 1 commit into
huggingface:mainfrom
jashshah999:fix/extra-special-tokens-duplicate-kwarg
Closed

Fix AddedToken duplicate 'special' kwarg for extra_special_tokens#44313
jashshah999 wants to merge 1 commit into
huggingface:mainfrom
jashshah999:fix/extra-special-tokens-duplicate-kwarg

Conversation

@jashshah999
Copy link
Copy Markdown
Contributor

Fixes the same TypeError: AddedToken() got multiple values for keyword argument 'special' that #44281 addressed, but for the extra_special_tokens code path which was missed.

#44281 (commit 8e663c7) correctly added value.pop("special", None) before AddedToken(**value, special=True) for regular special tokens loaded from special_tokens_map.json. However, the same pattern in the extra_special_tokens loop on the next line was not updated, so tokenizers whose extra_special_tokens dicts contain a "special" key still crash.

Related: #44062

Commit 8e663c7 (huggingface#44281) fixed the duplicate keyword argument error
for regular special tokens by popping the 'special' key before
passing it to AddedToken(..., special=True). However, the same
pattern in the extra_special_tokens loop was not fixed, meaning
tokenizers with extra_special_tokens dicts containing a 'special'
key would still crash with:
  TypeError: AddedToken() got multiple values for keyword argument 'special'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants