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

tokenization: add warning for double BOS #7332

Merged

Conversation

JohannesGaessler
Copy link
Collaborator

Alternative to #7107 .

This PR adds a warning when a BOS token is added automatically and this results in 2 BOS tokens at the beginning of the prompt since this is almost always going to be user error and not intentional.

reuank added a commit to reuank/ThinkBench that referenced this pull request May 16, 2024
…the llama.cpp server in order to avoid double BOS at the beginning of the prompt (see discussions at ggerganov/llama.cpp#7107 (comment) and ggerganov/llama.cpp#7332)
@mofosyne mofosyne added enhancement New feature or request Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix labels May 16, 2024
llama.cpp Outdated
@@ -12818,6 +12818,13 @@ static std::vector<llama_vocab::id> llama_tokenize_internal(const llama_vocab &
}
}

if (add_special && vocab.special_add_bos != 0 && output[1] == vocab.special_bos_id) {
Copy link
Owner

Choose a reason for hiding this comment

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

Think we should also check output.size() > 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants