Allow --launch together with --file/--accuracy in llamafile CLI by MohammadHijjawi97 · Pull Request #1807 · modelscope/modelscope · GitHub
Skip to content

Allow --launch together with --file/--accuracy in llamafile CLI - #1807

Open
MohammadHijjawi97 wants to merge 1 commit into
modelscope:masterfrom
MohammadHijjawi97:fix/llamafile-launch-with-file
Open

MohammadHijjawi97 wants to merge 1 commit into
modelscope:masterfrom
MohammadHijjawi97:fix/llamafile-launch-with-file

Conversation

@MohammadHijjawi97

Copy link
Copy Markdown

--launch is registered in the same mutually exclusive argparse group as --accuracy and --file. So you cannot pick a specific llamafile (or accuracy) and skip launching it at the same time:

$ modelscope llamafile --model <owner>/<repo> --file My-Model-14B-FP16.llamafile --launch False
modelscope llamafile: error: argument --launch: not allowed with argument --file

The same happens with --accuracy q8_0 --launch False. Only --accuracy and --file are meant to exclude each other; the code already documents that file takes precedence over accuracy. This PR registers --launch on the parser itself instead of the group.

Test: added test_launch_with_accuracy_or_file to tests/cli/test_llamfafile_cmd.py. It parses both combinations offline, fails on master, and passes with this change. The existing check that --file and --accuracy stay mutually exclusive still passes. flake8, isort and yapf are clean on the changed files.

`--launch` was registered in the same mutually exclusive group as
`--accuracy` and `--file`, so choosing a specific llamafile or accuracy
and skipping the launch at the same time was rejected by argparse:

    modelscope llamafile --model <id> --file <name>.llamafile --launch False
    error: argument --launch: not allowed with argument --file

Only `--accuracy` and `--file` are meant to exclude each other, so
register `--launch` on the parser itself.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant