Commit 4c4ca5b18 for llama.cpp
commit 4c4ca5b18854c973655a62a6164a3ae930ee76b0
Author: Georgi Gerganov <ggerganov@gmail.com>
Date: Wed Nov 4 10:32:45 2026 +0200
common : do not allow `_` in sidecar (#31639)
diff --git a/common/download.cpp b/common/download.cpp
index 4de93f30d..979dd6326 100644
--- a/common/download.cpp
+++ b/common/download.cpp
@@ -749,7 +749,7 @@ static hf_cache::hf_file find_best_model(const hf_cache::hf_files & files,
for (const auto & t : tags) {
// match the tag as a full token, so ":F16" does not match a BF16 file
- std::regex pattern("(^|[-./_])" + t + "[.-]", std::regex::icase);
+ std::regex pattern("(^|[-./])" + t + "[.-]", std::regex::icase);
for (const auto & f : files) {
if (gguf_filename_is_model(f.path) &&
std::regex_search(f.path, pattern)) {
diff --git a/tests/test-model-resolution.cpp b/tests/test-model-resolution.cpp
index 73a87482d..e2576a1c9 100644
--- a/tests/test-model-resolution.cpp
+++ b/tests/test-model-resolution.cpp
@@ -161,12 +161,6 @@ static const std::vector<std::string> twins = {
"model-Q4_XS.gguf",
};
-// an underscore separates the quant like a dash, as in step3p5_flash_Q4_K_S.gguf
-static const std::vector<std::string> underscore = {
- "model_Q4_K_S.gguf",
- "model_Q8_0.gguf",
-};
-
// every speculative sidecar type at the same quant
static const std::vector<std::string> quad = {
"model-Q8_0.gguf",
@@ -301,15 +295,6 @@ static const plan_case plan_cases[] = {
"model-IQ4_XS.gguf", {"model-IQ4_XS.gguf"},
"", "", "", "", ""},
- // the token boundary accepts an underscore, for the tag and the default lookup
- {"underscore tag", underscore, "test/repo:Q4_K_S", "", false, false,
- "model_Q4_K_S.gguf", {"model_Q4_K_S.gguf"},
- "", "", "", "", ""},
-
- {"underscore default", underscore, "test/repo", "", false, false,
- "model_Q8_0.gguf", {"model_Q8_0.gguf"},
- "", "", "", "", ""},
-
// every sidecar type resolves at the tag
{"quad exact tag", quad, "test/repo:Q8_0", "", true, false,
"model-Q8_0.gguf", {"model-Q8_0.gguf"},