[perf] [xgrammar] Import structural tag from xgrammar's builtin structural tag templates#43678
Closed
cjackal wants to merge 4 commits into
Closed
[perf] [xgrammar] Import structural tag from xgrammar's builtin structural tag templates#43678cjackal wants to merge 4 commits into
xgrammar's builtin structural tag templates#43678cjackal wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the xgrammar dependency from 0.2.0 to 0.2.1 and refactors the structural tag registry to delegate model-specific structural tag building directly to xgrammar. It also enables support for patternProperties and propertyNames in JSON schemas, removing previous workarounds and updating tests accordingly. One review comment suggests adding defensive checks when calling model_dump on tools and tool choices to prevent potential AttributeErrors when raw dictionaries are passed.
Contributor
Author
|
cc. @Seven-Streams @Ubospica if this PR befits what xgrammar team had in mind |
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>
7cb07cf to
20364c2
Compare
4 tasks
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Stacked on #42904
xgrammarto0.2.1to utilize structural tag improvement/bugfixes from xgrammar upstreamxgrammarinstead of vllm's forked onexgrammarteam, let alone reducing the maintenance burden ofvllmteamget_structural_tagmethod (one-digit lines diff!) in the corresponding tool parser and you are ready to go.I'd like this PR to be a migration-only change (no behavioral change / new model support) for the ease of review and to exploit the pre-existing unit tests. Further expanding the supported models is left as a follow-up, but as I mentioned above it is kind of trivial.
Test Plan
Check that existing unit tests pass.
Test Result
(To be updated after CI runs)
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.