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

Generating Illegal Escape Tokens #90

Open
jamesdborin opened this issue Apr 19, 2024 · 4 comments
Open

Generating Illegal Escape Tokens #90

jamesdborin opened this issue Apr 19, 2024 · 4 comments

Comments

@jamesdborin
Copy link

When generating with LMFE the model is able to generate escape tokens like \n, and whenever it does this it becomes very slow. This sounds a lot like a previous issue: #41

Here is an example that I generated using this model: TheBloke/CapybaraHermes-2.5-Mistral-7B-AWQ

Prompt:

[INST]

Generate a summary full of new lines and new line characters.

[/INST]

which used the schema:

{"properties": {"summary": {"type": "string"}}, "required": ["summary"], "type": "object"}

Output:

{ "summary" : "A \nsummary full \nof new lines and \nnew line characters.\n\n" }  

I tested this on version 0.9.6 and 0.8.2 (a version released shortly after #41 was resolved).

@noamgat
Copy link
Owner

noamgat commented Apr 19, 2024 via email

@AriX
Copy link
Contributor

AriX commented Apr 19, 2024

I saw this slowdown in the past and it was caused by an edge case where JSONSchemaParser's shortcut_key implementation did not consider the correct parser while finishing parsing an escape sequence. When the UnionParser that StringParsingState pops onto the stack after getting a BACKSLASH is finished but not yet removed from the stack, shortcut_key fails to return json_freetext.

@noamgat
Copy link
Owner

noamgat commented Apr 20, 2024

Can you check if v0.9.8 is faster in this case?

@jamesdborin
Copy link
Author

Whoops my mistake, I thought that /n was illegal - but yes part of the issue was this it was very slow when generating. Ill try the new version and see if that's faster.

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

No branches or pull requests

3 participants