fix: stop silently swallowing unknown Llama kwargs; --rpc_servers is a no-op (#2210) - #2364
Open
Anai-Guo wants to merge 1 commit into
Open
fix: stop silently swallowing unknown Llama kwargs; --rpc_servers is a no-op (#2210)#2364Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
`Llama.__init__` ends in a bare `**kwargs` that is never read, so any keyword it does not know is discarded without a word. The server hits this itself: `llama_cpp/server/model.py` still passes `rpc_servers=` and `mul_mat_q=`, neither of which is a parameter of `Llama.__init__` any more, so `--rpc_servers` has been a silent no-op. - warn on unexpected keyword arguments instead of dropping them - accept `embeddings=` as an alias for `embedding=` - stop passing the two dead settings from the server, and warn when a user actually set them Signed-off-by: Tai An <antai12232931@outlook.com>
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.
Fixes #2210
Problem
Llama.__init__ends in a bare**kwargs(llama_cpp/llama.py) that is never read anywhere in the body. Every keyword it does not recognise is silently discarded, so a wrong spelling produces no error at the call site — the failure surfaces much later, or not at all.This is not hypothetical: the bundled server hits it itself.
llama_cpp/server/model.pystill passes two settings that are no longer parameters ofLlama.__init__:rpc_serversmodel.py, fromModelSettings.rpc_servers(--rpc_servers)llama_model_paramsno longer carries an rpc-servers fieldmul_mat_qmodel.py, fromModelSettings.mul_mat_qSo
python3 -m llama_cpp.server --rpc_servers host:porthas been a silent no-op: the flag is accepted, documented in--help, and thrown away.The same sink swallows
embeddings=True(plural) — the spelling used byllama_model_params/llama_context_paramsand byLlama.__getstate__'s own round-trip, so it is an easy thing to reach for.Changes
llama_cpp/llama.py— warn (UserWarning) on unexpected keyword arguments instead of dropping them, and acceptembeddings=as an alias forembedding=. The signature is unchanged and nothing is turned into an error, so no existing caller breaks.llama_cpp/server/model.py— stop passingrpc_servers=/mul_mat_q=toLlama(...), and warn if the user actually set either, so the setting fails loudly instead of silently.llama_cpp/server/settings.py— say in the field descriptions that both are deprecated and ignored.Both halves are needed: patching only
llama.pywould make the new warning fire on every server start, because the server is itself a caller of the sink.Verification
No model or compiled backend needed — the check is a signature replay against the real
Llama.__init__(extracted from the file withast) plus executing the new prologue verbatim from the patched source.ruff format --checkandruff check(repopyproject.toml, ruff 0.15.11) are clean on all three files.Note
Issue #2210 describes the alias in the other direction (
embeddingas the old name). On currentmainit is the reverse —embeddingis the real parameter — so this PR adds the alias in the direction that actually silently fails today. If you would rather restore working RPC support than deprecaterpc_servers, that is a larger change against the currentllama_model_paramsand I am happy to split it out.🤖 Generated with Claude Code