Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve list type of additional_special_tokens in special_token_map #12759

Merged
merged 3 commits into from
Jul 16, 2021

Conversation

SaulLu
Copy link
Contributor

@SaulLu SaulLu commented Jul 16, 2021

What does this PR do?

Fixes #12598

As shown in the issue, the value associated with the additional_special_tokens key in the special_tokens_map attribute of a tokenizer was of type string while its content is rather a list. This PR proposes a fix to keep the list type and adds tests.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. @LysandreJik and @sgugger, I would love to have a second look if there was ever a reason I missed that required the list to become a string.

@SaulLu SaulLu changed the title Preserve list type of additional_special_tokens in special_token_map [WIP] Preserve list type of additional_special_tokens in special_token_map Jul 16, 2021
@SaulLu SaulLu changed the title [WIP] Preserve list type of additional_special_tokens in special_token_map Preserve list type of additional_special_tokens in special_token_map Jul 16, 2021
@SaulLu SaulLu requested review from sgugger and LysandreJik July 16, 2021 13:45
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for fixing!

src/transformers/tokenization_utils_base.py Outdated Show resolved Hide resolved
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @SaulLu!

@SaulLu SaulLu merged commit 6e87010 into huggingface:master Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tokenizer.special_tokens_map has stringified list for "additional_special_tokens" value.
3 participants