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

Encode special tokens #1437

Merged
merged 17 commits into from
Jan 19, 2024
Merged

Encode special tokens #1437

merged 17 commits into from
Jan 19, 2024

Conversation

ArthurZucker
Copy link
Collaborator

Allow skipping special tokens when encoding

fixes #1347, fixes #1391 fixes #1368

Snippet:

>>> from transformers import AutoTokenizer
>>> tokenizer = AutoTokenizer.from_pretrained("gp2") 
>>> tokenizer.tokenize("<|endoftext|>")
['<|endoftext|>']

>>> tokenizer._tokenizer.encode_special_tokens = True
>>> tokenizer.tokenize("<|endoftext|>")
['<', '|', 'end', 'of', 'text', '|', '>']

@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 merged commit 6a77d48 into main Jan 19, 2024
24 checks passed
@ArthurZucker ArthurZucker deleted the encode-special-tokens branch January 19, 2024 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants