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

Switch grammar backend to Formatron #252

Merged
merged 8 commits into from
Dec 13, 2024
Merged

Conversation

DocShotgun
Copy link
Member

@DocShotgun DocShotgun commented Nov 23, 2024

Is your pull request related to a problem? Please describe.
N/A

Why should this feature be added?
Simplify dependencies and improve grammar-constrained inference performance.

Examples
N/A

Additional context
To-do:

  • Implement regex
  • Implement JSON schema
  • Implement KBNF grammar
  • Is lru_cache needed?

Other:

* Replace LMFE's regex and JSON schema filters with Formatron's
* Remove Outlines EBNF filter in preparation for Formatron KBNF filter
* TODO: Implement Formatron KBNF filter
* Also remove empty cache clear function
@DocShotgun DocShotgun marked this pull request as ready for review November 24, 2024 19:37
@Dan-wanna-M
Copy link

@DocShotgun building KBNF's vocabulary should be around 1 second(though you may want to test out on your own) so lru_cache is needed if you think this is too slow. You may also want to benchmark building a filter out of a reasonably complex json schema and decide whether you want some caches for building filters as well.

bdashore3 and others added 3 commits December 5, 2024 23:01
* Avoid rebuilding the KBNF engine vocabulary on every grammar-enabled request
v0.2.6

Signed-off-by: kingbri <[email protected]>
@bdashore3 bdashore3 merged commit 1ba33bf into theroyallab:main Dec 13, 2024
1 check 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.

3 participants