feat(help): list all accepted llama.cpp options in --help#1003
Conversation
llamafile --help (and --chat/--cli --help) printed a small, hand-written option list that was missing many flags llamafile actually accepts -- e.g. --top-k, --top-p, --temperature, --ctx-size, --repeat-penalty, -t, --port. Only --server --help was complete, because it fell through to llama.cpp's own usage printer. Rather than maintain a second copy of the option list (which is what drifted), delegate the full catalogue to the same code path --server --help already uses: common_params_parse() with the llama_example the target mode feeds it at runtime (LLAMA_EXAMPLE_SERVER for server/auto, LLAMA_EXAMPLE_CLI for chat/cli). Changes: - main.cpp: add print_llama_cpp_usage() which calls common_params_parse() to print the categorized llama.cpp option list (common/sampling/spec/ example-specific) and exit(0) on --help. The print_*_help() functions now take a show_full_list_hint bool: the --help path prints the llamafile intro (modes + llamafile-specific flags) and appends the full llama.cpp list; the missing--m error path prints the intro plus a pointer to --help. --server --help is unchanged (still falls through to server_main). The duplicate SERVER/AUTO missing--m arms are collapsed (they printed identical text). - tests/integration/tests/test_help.py: new model-free regression tests that invoke every --help variant and assert exit 0, the llamafile identity, the llamafile-specific flags, and that the previously-missing llama.cpp options (--top-k, --top-p, --temperature, --ctx-size, --repeat-penalty, -ngl) now appear. Also covers the missing--m error path. - tests/integration/pyproject.toml: register the "help" test marker. Because the full option list comes from llama.cpp's own parser, --help stays in sync with what llamafile accepts as upstream evolves -- no hand-maintained copy to drift again. Verified: `make check` passes (extract_data_uris 19/19, fa_helpers 3/3, gpu_backend 23/23); new `pytest tests/integration/tests/test_help.py --executable o//llamafile/llamafile` passes 17/17; manual check of all four --help variants confirms --top-k/--top-p/--temperature/--ctx-size/ --repeat-penalty/-ngl now appear alongside the llamafile-specific flags. Generated with pi 0.80.2 and GLM 5.2
|
Turns out my actual issue was that the options aren't exposed by --chat, only --server and yes this PR fixes that |
aittalam
left a comment
There was a problem hiding this comment.
Hi @RichardoC , and thank you for making the help system more clear!
I ran the tests and they seem to work both standalone (without provinding any model) and when the models are provided (see below). I think that's great, and I am not too worried about repeating the help tests as one can turn it off (-m "not help") for pre-built models and just run it once with the plain executable, or run it for each model as it is quite fast and does not add a big overhead.
Just a minor UX inconsistency: when one runs llamafile --server the help provides examples for all three "run llamafile --server --help", "run llamafile --cli --help", etc rather than just the --server example. I already have a fix for that (adding a server-specific help and activating it in the case section), would you mind testing it and letting me know what you think of it?
|
Re-tested and merged, thanks again @RichardoC ! |
|
Thanks for sorting all this folks! Sorry about the delay in responses, got busy with work. I'm happy with the changes you folks have made |
Description
Why this PR?
Currently, it's not possible to use just the cli to run a model from a gguf file. Yuo have to consult the upstream docs to work out the correct arguments to pass.
What is this PR?
lamafile --help (and --chat/--cli --help) printed a small, hand-written option list that was missing many flags llamafile actually accepts -- e.g. --top-k, --top-p, --temperature, --ctx-size, --repeat-penalty, -t, --port. Only --server --help was complete, because it fell through to llama.cpp's own usage printer.
Rather than maintain a second copy of the option list (which is what drifted), delegate the full catalogue to the same code path --server --help already uses: common_params_parse() with the llama_example the target mode feeds it at runtime (LLAMA_EXAMPLE_SERVER for server/auto, LLAMA_EXAMPLE_CLI for chat/cli).
Changes:
Because the full option list comes from llama.cpp's own parser, --help stays in sync with what llamafile accepts as upstream evolves -- no hand-maintained copy to drift again.
Verified:
make checkpasses (extract_data_uris 19/19, fa_helpers 3/3, gpu_backend 23/23); newpytest tests/integration/tests/test_help.py --executable o//llamafile/llamafilepasses 17/17; manual check of all four --help variants confirms --top-k/--top-p/--temperature/--ctx-size/ --repeat-penalty/-ngl now appear alongside the llamafile-specific flags.Generated with pi 0.80.2 and GLM 5.2
PR Type
Relevant issues
Checklist
llama.cpp/,whisper.cpp/, orstable-diffusion.cpp/, I also updated the matching*.patches/files.AI Usage Information
When answering reviewer questions, please respond yourself rather than pasting reviewer comments into an AI system and posting the reply back unchanged.