docs: add xgrammar structured output troubleshooting section and fix script#1075
Open
scubamount wants to merge 1 commit into
Open
docs: add xgrammar structured output troubleshooting section and fix script#1075scubamount wants to merge 1 commit into
scubamount wants to merge 1 commit into
Conversation
Adds a comprehensive structured output (xgrammar) troubleshooting section to README: - Error table for common failure modes (missing RECORD, broken rpaths, SIP kills) - Step-by-step manual fix (RECORD file, install_name_tool rpaths, codesign re-sign, load_binding.py patch) - Reference to scripts/fix-xgrammar.py as automated alternative Also adds scripts/fix-xgrammar.py: a version-agnostic Python helper that automates all four fix steps, detects both HEAD and stable Cellar paths, and verifies the result.
b7bae05 to
5ce6c04
Compare
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.
Summary
Adds comprehensive troubleshooting documentation for xgrammar / structured output in the OMLX README, plus an automated fix script.
Problem
Structured output (grammar-constrained generation) requires during install. However, the formula's hook silently fails in some environments, leaving users with cryptic errors:
Cannot find library: libxgrammar_bindings.dylibLibrary not loaded: @rpath/libtvm_ffi.dylibKilled: 9onimport xgrammarThe README previously only said "reinstall with " with no explanation of what to do when that doesn't work.
Changes
README.mdscripts/fix-xgrammar.pyTesting
OMLX xgrammar fix script
[1/5] libexec: /opt/homebrew/Cellar/omlx/HEAD-5963356/libexec
[2/5] site-packages: /opt/homebrew/Cellar/omlx/HEAD-5963356/libexec/lib/python3.11/site-packages
[3/5] Creating RECORD file...
Creating RECORD at /opt/homebrew/Cellar/omlx/HEAD-5963356/libexec/lib/python3.11/site-packages/xgrammar-0.1.33.dist-info/RECORD
[ok] Created 62 RECORD entries
[4/5] Fixing dylib rpaths...
ERROR: libxgrammar_bindings.dylib not found: /opt/homebrew/Cellar/omlx/HEAD-5963356/libexec/lib/python3.11/site-packages/xgrammar/libxgrammar_bindings.dylib
OK