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

[FEAT] Constrained generation/Grammar #71

Merged
merged 4 commits into from
Feb 25, 2024
Merged

[FEAT] Constrained generation/Grammar #71

merged 4 commits into from
Feb 25, 2024

Conversation

bdashore3
Copy link
Member

Adds support for constraining generation to a certain output. This PR will add the following:

Notes:

  • JSON schemas are a standardized format for declaring the properties of a JSON. It's extendable and easy to use. There are websites that allow for schema creation such as JsonGenerator
  • Outlines isn't exactly the fastest library out there but provides EBNF support that can be hooked into ExllamaV2. Eventually, this will be replaced by a more flexible in-house solution.

Add the ability to constrain the return value of a model to be JSON.
Built using the JSON schema standard to define the properties of what
the model should return.

This feature should be more accurate than using GBNF/EBNF to yield
the same results due to the use of lmformatenforcer.

GBNF/EBNF will be added in a different commit/branch.

Signed-off-by: kingbri <bdashore3@proton.me>
Using the Outlines library, add support to supply EBNF strings and
pass them to the library for parsing.

From there, a wrapper is created and a filter is passed to generation.

Replace with an in-house solution at some point that's more flexible.

Signed-off-by: kingbri <bdashore3@proton.me>
Use the standard import ordering.

Signed-off-by: kingbri <bdashore3@proton.me>
These classes are in the newest version now.

Signed-off-by: kingbri <bdashore3@proton.me>
@bdashore3 bdashore3 merged commit fc85789 into main Feb 25, 2024
1 check passed
@bdashore3 bdashore3 deleted the json-grammar branch March 5, 2024 04:36
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.

1 participant