fix(llama-cpp): preserve GPU layers during option passthrough - #11193
Merged
Conversation
Stage the negative GPU-layer sentinels expected by the upstream argument parser, then restore LocalAI resolved values unless a passthrough flag explicitly overrides them. This avoids the parser assertion that terminated the backend for any generic option. Assisted-by: Codex:gpt-5
Owner
|
@localai-org-maint-bot did you reproduced it locally? |
Collaborator
Author
|
Yes, but at the focused parser-path level rather than through a full LocalAI backend build. I reproduced the exact llama.cpp assertion locally by exercising the option-registration path with pre-resolved |
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.
Description
Fixes #11191.
The latest llama.cpp argument parser asserts that main and draft
n_gpu_layersstill contain negative initialization sentinels when parser options are registered. LocalAI resolves those fields from the model request before applying generic passthrough flags, so any passthrough option could abort the backend and surface as an EOF from the frontend.This stages the parser sentinels while applying raw flags, then restores LocalAI's resolved GPU-layer values unless the passthrough explicitly supplies a main or draft GPU-layer flag. Explicit
autoremains authoritative.Notes for Reviewers
auto.NLOHMANN_INCLUDE=backend/cpp/llama-cpp/llama.cpp/vendor bash backend/cpp/run-unit-tests.sh(3 test files).Signed commits