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

Bug Fix: Json Decoder aggessively pulls json #867

Merged
merged 5 commits into from Mar 5, 2024

Conversation

MDCurrent
Copy link
Contributor

Background
Had this problem on 2 different setups, essentially the decoder for llamacpp would grab partially streamed json and decode it without the new line

Description

Just wait until we see a new line character before trying to decode the json. if we fail to decode a token, just toss it. *may lead to tokens being thrown out but after a couple of days of running this thru the ringer it seemed to work, and dropping a word is a better UX than just crashing when it fails to decode the response

@MDCurrent
Copy link
Contributor Author

Screenshot from 2024-02-22 09-40-58
this is the type of output id get when trying to hit my locall llamacpp server

Copy link
Collaborator

@nsarrazin nsarrazin left a comment

Choose a reason for hiding this comment

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

Seems to work well, will merge!

@nsarrazin nsarrazin merged commit 9c5a826 into huggingface:main Mar 5, 2024
3 checks passed
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