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

[ TokenizationLlama] fix the way we convert tokens to strings to keep leading spaces 🚨 breaking fix #29453

Merged
merged 4 commits into from
Mar 28, 2024

Conversation

ArthurZucker
Copy link
Collaborator

@ArthurZucker ArthurZucker commented Mar 5, 2024

What does this PR do?

Fixes #29452. Before the prefix_space added by add_dummy_prefix_space was eaten by the decode function. This is silent, not expected and thus should not be there.

input_ids = tokenizer.encode("hello", add_special_tokens=True) would produce ["<s>", "▁hello"] but decoded as "<s>hello"

@ArthurZucker ArthurZucker changed the title nit [ TokenizationLlama] fix the way we convert tokens to strings to not always strip prefix space Mar 5, 2024
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ArthurZucker ArthurZucker marked this pull request as ready for review March 7, 2024 07:29
@ArthurZucker ArthurZucker changed the title [ TokenizationLlama] fix the way we convert tokens to strings to not always strip prefix space [ TokenizationLlama] fix the way we convert tokens to strings to keep leading spaces Mar 7, 2024
@ArthurZucker ArthurZucker requested a review from LysandreJik March 7, 2024 09:15
Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@ArthurZucker ArthurZucker changed the title [ TokenizationLlama] fix the way we convert tokens to strings to keep leading spaces [ TokenizationLlama] fix the way we convert tokens to strings to keep leading spaces 🚨 breaking fix Mar 28, 2024
@ArthurZucker ArthurZucker merged commit a2a7f71 into main Mar 28, 2024
19 checks passed
@ArthurZucker ArthurZucker deleted the fix-llama-decode branch March 28, 2024 12:58
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.

Mistral Tokenizer.decode() add a space when use_fast=True
3 participants