llama-quant : fix --tensor-type when default qtype is overriden#22572
Merged
Conversation
fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
3 tasks
compilade
approved these changes
May 1, 2026
CISC
approved these changes
May 1, 2026
pwilkin
approved these changes
May 1, 2026
samuraieng
pushed a commit
to samuraieng/llama.cpp
that referenced
this pull request
May 6, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
ljubomirj
pushed a commit
to ljubomirj/llama.cpp
that referenced
this pull request
May 6, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
meh
pushed a commit
to meh/llama.cpp
that referenced
this pull request
May 10, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
baramofme
pushed a commit
to baramofme/llama-cpp-turboquant
that referenced
this pull request
May 23, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here. (cherry picked from commit b97ebdc)
carlosfundora
pushed a commit
to carlosfundora/llama.cpp-1-bit-turbo
that referenced
this pull request
May 24, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here. (cherry picked from commit b97ebdc)
winstonma
pushed a commit
to winstonma/llama.cpp
that referenced
this pull request
May 27, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
fewtarius
pushed a commit
to fewtarius/CachyLLama
that referenced
this pull request
May 30, 2026
…gml-org#22572) fix ggml-org#22544 (my fault!) Credit to @Anai-Guo, ref ggml-org#22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
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.
fix #22544 (my fault!)
Overview
Currently, when using
--tensor-type "<regex>=GGML_TYPE", if theGGML_TYPEoverride matches the default type for the chosen outputftype, the internal heuristics inllama_tensor_get_type_implmay still take effect, rather than being locked to the specifiedGGML_TYPE.This is my own mistake that I introduced in #19770.
ggml_type new_type = default_type; // get more optimal quantization type based on the tensor shape, layer, etc. if (!params->pure && ggml_is_quantized(default_type)) { // if the user provided tensor types - use those bool manual = false; if (!qs.tensor_type_patterns.empty()) { const std::string tensor_name(tensor->name); for (const auto & [pattern, qtype] : qs.tensor_type_patterns) { if (std::regex_search(tensor_name, pattern)) { if (qtype != new_type) { LLAMA_LOG_WARN("%s: %-36s - applying manual override: %s -> %s\n", __func__, tensor_name.c_str(), ggml_type_name(new_type), ggml_type_name(qtype)); new_type = qtype; manual = true; // THIS IS WRONG break; // THIS IS WRONG } // MOVED TO HERE! // MOVED TO HERE! } } } // if not manual - use the standard logic for choosing the quantization type based on the selected mixture if (!manual) { new_type = llama_tensor_get_type_impl(qs, new_type, tensor, params->ftype, tm.category); }Additional information
Credit to @Anai-Guo, ref #22559 - since that one was closed due to the new contributor policy I am taking the liberty of re-submitting that PR here.
Requirements