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

[Core] choice-based structured output with xgrammar #12632

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

russellb
Copy link
Member

@russellb russellb commented Jan 31, 2025

  • xgrammar: upgrade to 0.1.11
  • xgrammar guided choice support

part of issue #12131

commit beba609
Author: Russell Bryant rbryant@redhat.com
Date: Thu Jan 30 10:50:43 2025 -0500

xgrammar: upgrade to 0.1.11

Signed-off-by: Russell Bryant <rbryant@redhat.com>

commit 4b694af
Author: Russell Bryant rbryant@redhat.com
Date: Thu Jan 30 12:38:25 2025 -0500

xgrammar guided choice support

This commit adds support for using xgrammar with a set of choices.
This can be converted to an EBNF grammar pretty easily, which xgrammar
can work from. This drops a case where we were falling back to outlines.

Part of issue #12131

Signed-off-by: Russell Bryant <rbryant@redhat.com>

Signed-off-by: Russell Bryant <rbryant@redhat.com>
This commit adds support for using xgrammar with a set of choices.
This can be converted to an EBNF grammar pretty easily, which xgrammar
can work from. This drops a case where we were falling back to outlines.

Part of issue vllm-project#12131

Signed-off-by: Russell Bryant <rbryant@redhat.com>
@russellb russellb requested a review from mgoin as a code owner January 31, 2025 21:32
Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@mergify mergify bot added the ci/build label Jan 31, 2025
@mgoin mgoin added structured-output ready ONLY add when PR is ready to merge/full CI is needed labels Jan 31, 2025
Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

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

LGTM given green CI, thank you!

tokenizer_hash=tokenizer_hash,
max_threads=max_threads,
tokenizer_data=tokenizer_data,
)
else:
raise ValueError(
"Currently only support JSON and EBNF grammar mode for xgrammar"
Copy link
Member

Choose a reason for hiding this comment

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

Should add choice here as well

Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @russellb!

vllm/model_executor/guided_decoding/xgrammar_decoding.py Outdated Show resolved Hide resolved
Co-authored-by: Nick Hill <nhill@redhat.com>
Signed-off-by: Russell Bryant <rbryant@redhat.com>
@russellb russellb force-pushed the xgrammar-update-0.1.11 branch from 960b475 to 91e0b5c Compare February 3, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build ready ONLY add when PR is ready to merge/full CI is needed structured-output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants