common: fix explicit -md precedence over draft sidecar resolution#26165
Conversation
Follow-up of ggml-org#25955, an explicit --model-draft file given with -hfd was silently overridden by the sidecar resolution of the draft repo, and its path was never resolved to a local file. An explicit draft file selection now disables the sidecar resolution, so the manual CLI configuration wins over the automatic one.
|
For my understanding, when the logic resolves the sidecar automatically how does it determine which quantization to pick up? For example this command: llama serve \
--hf-repo ggml-org/Qwen3.6-27B-GGUF:Q8_0 \
--hf-repo-draft ggml-org/Qwen3.6-27B-GGUF \
--spec-type draft-mtpwill pick the Also, this command works: # request Q8_0 MTP
llama serve \
--hf-repo ggml-org/Qwen3.6-27B-GGUF:Q8_0 \
--hf-repo-draft ggml-org/Qwen3.6-27B-GGUF:Q8_0 \
--spec-type draft-mtpbut this command fails: # request Q4_0 MTP
llama serve \
--hf-repo ggml-org/Qwen3.6-27B-GGUF:Q8_0 \
--hf-repo-draft ggml-org/Qwen3.6-27B-GGUF:Q4_0 \
--spec-type draft-mtp
# error:
# 0.01.122.954 E llama_model_load_from_file_impl: exactly one out metadata, path_model, and file must be defined |
|
The sidecar quant is anchored on the draft plan primary, so no tag falls back to the default Q4_K_M hence mtp-Q4_0, and :Q4_0 fails because it first requires a full Q4_0 model to exist, the tag should apply to the sidecar directly when a spec type is requested, fixing it |
The sidecar selection was anchored on the primary of the draft plan, so a tag without a matching full model aborted the whole plan, and the sidecar quant silently followed the default model pick. The tag now anchors the sidecar directly: exact tag match first, then closest quant to the tag, and a requested sidecar resolves even when no full model matches the tag. A wired draft sidecar also counts as an explicit draft, so the main plan no longer downloads a second one.
|
Let's promote these logs from trace to info for consistency with the mmproj and primary: diff --git a/common/speculative.cpp b/common/speculative.cpp
index 3cb08767b..ee94d7c37 100644
--- a/common/speculative.cpp
+++ b/common/speculative.cpp
@@ -2284,7 +2284,7 @@ common_speculative_init_result::common_speculative_init_result(
std::string model_path;
if (has_draft) {
model_path = params.speculative.draft.mparams.path;
- LOG_TRC("%s: loading draft model '%s'\n", __func__, model_path.c_str());
+ LOG_INF("%s: loading draft model '%s'\n", __func__, model_path.c_str());
llama_model * model_dft = llama_model_load_from_file(params.model.path.c_str(), mparams);
if (model_dft == NULL) {
@@ -2304,7 +2304,7 @@ common_speculative_init_result::common_speculative_init_result(
} else if (spec_mtp) {
model_path = params.model.path;
- LOG_TRC("%s: creating MTP draft context against the target model '%s'\n", __func__, model_path.c_str());
+ LOG_INF("%s: creating MTP draft context against the target model '%s'\n", __func__, model_path.c_str());
llama_context * ctx_dft = llama_init_from_model(model_tgt, cparams);
if (ctx_dft == nullptr) {Seeing what data is loaded is useful even in |
Show the loaded draft model and the MTP draft context at the default verbosity, for consistency with the mmproj and primary logs. Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
ggerganov
left a comment
There was a problem hiding this comment.
We should think about adding unit tests for a few common configurations to check that the correct files are being downloaded. We'll soon add dspark support and it might cause some extra stir in the sidecar resolution implementation.
|
What do you think about testing on synthetic repo layouts, hardcoded file listings mimicking real repos like Qwen etc..., so the resolution and the task assembly are asserted without the flakiness of CI internet access, this also lets us cover a large amount of configurations, close to an exhaustive check of the resolution logic ? |
|
Sounds good. Do you have an idea how to simulate these synthetic repos with the existing HF model resolution logic? |
|
What about doing it in C++, splitting the existing functions so the resolution takes the file listing as input, then the test just hardcodes in-memory listings |
|
Like this : |
|
I'm checking if we can run a test that includes the code without modifying it, in order to wrap tests around it. |
Overview
An explicit --model-draft file given with -hfd was silently overridden by the sidecar resolution of the draft repo, and its path was never resolved to a local file.
An explicit draft file selection now disables the sidecar resolution, so the manual CLI configuration wins over the automatic one.
The -hfd tag now also applies to the sidecar resolution directly, so requesting a quant that only exists as a sidecar works instead of failing on the missing full model.
Additional information
Follow-up of #25955