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

Options for special token handling #13

Closed
grantjenks opened this issue Mar 14, 2024 · 3 comments
Closed

Options for special token handling #13

grantjenks opened this issue Mar 14, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@grantjenks
Copy link

Would be nice to have options for special token handling. I got this error today:

ValueError: Encountered text corresponding to disallowed special token '<|endoftext|>'.
If you want this text to be encoded as a special token, pass it to `allowed_special`, e.g. `allowed_special={'<|endoftext|>', ...}`.
If you want this text to be encoded as normal text, disable the check for this token by passing `disallowed_special=(enc.special_tokens_set - {'<|endoftext|>'})`.
To disable this check for all special tokens, pass `disallowed_special=()`.
@simonw simonw added the enhancement New feature or request label May 2, 2024
@simonw
Copy link
Owner

simonw commented May 2, 2024

I just ran cross this myself: https://twitter.com/simonw/status/1786172033245597997

ttok '<|endoftext|>' --encode

I'm going to add a --allow-special option.

@simonw
Copy link
Owner

simonw commented May 2, 2024

simonw added a commit that referenced this issue May 2, 2024
@simonw simonw closed this as completed in 7081f94 May 2, 2024
simonw added a commit that referenced this issue May 2, 2024
@simonw
Copy link
Owner

simonw commented May 2, 2024

ttok '<|endoftext|>' --encode --allow-special
100257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants