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

Local backends fix #18

Merged
merged 11 commits into from
Nov 27, 2023
Merged

Conversation

Gnurro
Copy link
Contributor

@Gnurro Gnurro commented Nov 14, 2023

Fix to properly cull prompt from model output.
The old code uses tokenizer.apply_chat_template(messages, tokenize=False to get the prompt with chat formatting as string - but this method call does not return the actual decoded result, but one that is missing whitespaces, thus preventing string match for replacement. Decoding the actual tokenized prompt instead solves this issue.

@Gnurro
Copy link
Contributor Author

Gnurro commented Nov 14, 2023

As a note: The issue occurs with the Llama2-chat tokenizer - it does not with the ~10 other tokenizers I've tested this with, hence the oversight.
Changed it for the HF backend as well to prevent this occuring if a model/tokenizer added in the future has the same issue.

@sherzod-hakimov sherzod-hakimov merged commit 36ef804 into clp-research:main Nov 27, 2023
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.

None yet

2 participants