38 lines
1.1 KiB
Makefile
38 lines
1.1 KiB
Makefile
XGRAMMAR_DIR ?= $(HOME)/git/xgrammar
|
|
VENV := .venv
|
|
PY := $(VENV)/bin/python
|
|
SAMPLES ?= 4
|
|
TEMPERATURE ?= 0.9
|
|
|
|
.PHONY: run smoke setup xgrammar clean help
|
|
|
|
help:
|
|
@echo "make setup - create uv venv and install deps + local xgrammar (editable)"
|
|
@echo "make run - run all scenarios and write report.md (constrained vs unconstrained)"
|
|
@echo "make smoke - quick single-tool smoke test"
|
|
@echo "make xgrammar - reinstall local xgrammar after C++/python changes"
|
|
@echo "make clean - remove venv and report"
|
|
|
|
$(VENV)/.stamp:
|
|
uv venv --python 3.13 $(VENV)
|
|
uv pip install --python $(PY) torch transformers accelerate jsonschema
|
|
uv pip install --python $(PY) -e $(XGRAMMAR_DIR)
|
|
touch $@
|
|
|
|
setup: $(VENV)/.stamp
|
|
|
|
xgrammar: $(VENV)/.stamp
|
|
uv pip install --python $(PY) -e $(XGRAMMAR_DIR)
|
|
|
|
run: $(VENV)/.stamp
|
|
$(PY) test_gemma4_scenarios.py --samples $(SAMPLES) --temperature $(TEMPERATURE) --report report.md
|
|
@echo ""
|
|
@echo "==================== report.md ===================="
|
|
@cat report.md
|
|
|
|
smoke: $(VENV)/.stamp
|
|
$(PY) test_gemma4_xgrammar.py
|
|
|
|
clean:
|
|
rm -rf $(VENV) report.md
|