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

server: do not remove whitespace at the start of a completion chunk #7524

Merged
merged 1 commit into from
May 28, 2024

Conversation

mgroeber9110
Copy link
Contributor

When using Completion mode of the server in recent builds, the first token of the predicted text is typically appended to the prompt without a space character. This can lead to problems when manually editing the text and then predicting again, because the missing space will appear in the new prompt.

Leading spaces are explicitly trimmed in CompletionControls(), which appears to be unnecessary after #2810 because even the initial prompt will not contain any extra leading space, and all further spaces should be resulting from predictions.

So, this PR proposes removing this trimming in Completion mode (but not in Chat mode, where it is still done in runLlama() and looks necessary to avoid an extra space between the role name and the prompt).

@mofosyne mofosyne added Apple Metal https://en.wikipedia.org/wiki/Metal_(API) Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix and removed Apple Metal https://en.wikipedia.org/wiki/Metal_(API) labels May 25, 2024
@mofosyne mofosyne self-requested a review May 25, 2024 13:58
@mofosyne mofosyne added the merge ready indicates that this may be ready to merge soon and is just holding out in case of objections label May 25, 2024
@mofosyne mofosyne merged commit 9335b96 into ggerganov:master May 28, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples merge ready indicates that this may be ready to merge soon and is just holding out in case of objections Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants