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

Enable special token support for exllamav2 #4314

Merged
merged 1 commit into from
Oct 21, 2023
Merged

Conversation

JohanAR
Copy link
Contributor

@JohanAR JohanAR commented Oct 18, 2023

Checklist:

@Ph0rk0z
Copy link
Contributor

Ph0rk0z commented Oct 18, 2023

should it also use 'skip_special_tokens', ?

@JohanAR
Copy link
Contributor Author

JohanAR commented Oct 18, 2023

should it also use 'skip_special_tokens', ?

Not sure.. skip_special_tokens appears to be a setting for the Transformers tokenizer, but it seems like this might be the same as setting decode_special_tokens=False for exllamav2

@JohanAR
Copy link
Contributor Author

JohanAR commented Oct 18, 2023

I updated the commit to add this setting and it appears to be working as expected.

Though with the only models I have that use special tokens (ChatML ending reply with <|im_end|>) I think at least in the notepad tab one would want skip_special_tokens=False for multi-turn conversations, but it seems like it defaults to True for all models. Not sure about the other tabs.

Also I'm not entirely sure about the decode function which doesn't take a state parameter. If I hard code it to False there I think the notebook Tokens sub-tab wrote empty strings instead of special tokens, so True appears to be better. No idea if it affects other things.

@oobabooga oobabooga merged commit 1d5a015 into oobabooga:main Oct 21, 2023
@oobabooga
Copy link
Owner

Thanks for the PR. The state parameter goes to the generation functions, which can pass state['skip_special_tokens'] to the decode function as you did. I think that your implementation is correct and no further changes are needed.

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.

3 participants