quant.cpp
quant.cpp copied to clipboard
Add --json output mode for PPL measurement
The --ppl (perplexity) mode in tools/quant.c currently prints human-readable text output. For CI pipelines and automated benchmarking, a machine-parseable JSON output mode would be very useful.
What to do:
- Add a
--jsonflag that can be combined with--ppl. - When both flags are set, output a JSON object with fields like
{"perplexity": 5.42, "tokens": 1024, "model": "..."}instead of the formatted text. - Keep the default behavior unchanged when
--jsonis not specified.
Files to touch: tools/quant.c (argument parsing and PPL output section).
Implemented in 69f2994. ./quant model.gguf --ppl text.txt --json outputs machine-parseable JSON to stdout.