fix speculative logging

This commit is contained in:
Concedo
2026-07-13 18:29:21 +08:00
parent 2f7d1bb5c4
commit 91b1e1c89a
2 changed files with 9 additions and 7 deletions
+5 -5
View File
@@ -74,14 +74,14 @@ static bool common_speculative_are_compatible(
SPC_DBG("vocab_type dft: %d\n", vocab_type_dft);
if (vocab_type_tgt != vocab_type_dft) {
SPC_WRN("draft model vocab type must match target model to use speculation but "
SPC_ERR("draft model vocab type must match target model to use speculation but "
"vocab_type_dft = %d while vocab_type_tgt = %d\n", vocab_type_dft, vocab_type_tgt);
return false;
}
if (llama_vocab_get_add_bos(vocab_tgt) != llama_vocab_get_add_bos(vocab_dft) ||
(llama_vocab_get_add_bos(vocab_tgt) && llama_vocab_bos(vocab_tgt) != llama_vocab_bos(vocab_dft))) {
SPC_WRN("draft model bos tokens must match target model to use speculation. add: %d - %d, id: %d - %d)\n",
SPC_ERR("draft model bos tokens must match target model to use speculation. add: %d - %d, id: %d - %d)\n",
llama_vocab_get_add_bos(vocab_tgt), llama_vocab_get_add_bos(vocab_dft),
llama_vocab_bos(vocab_tgt), llama_vocab_bos(vocab_dft));
return false;
@@ -89,7 +89,7 @@ static bool common_speculative_are_compatible(
if (llama_vocab_get_add_eos(vocab_tgt) != llama_vocab_get_add_eos(vocab_dft) ||
(llama_vocab_get_add_eos(vocab_tgt) && llama_vocab_eos(vocab_tgt) != llama_vocab_eos(vocab_dft))) {
SPC_WRN("draft model eos tokens must match target model to use speculation. add: %d - %d, id: %d - %d)\n",
SPC_ERR("draft model eos tokens must match target model to use speculation. add: %d - %d, id: %d - %d)\n",
llama_vocab_get_add_eos(vocab_tgt), llama_vocab_get_add_eos(vocab_dft),
llama_vocab_eos(vocab_tgt), llama_vocab_eos(vocab_dft));
return false;
@@ -103,7 +103,7 @@ static bool common_speculative_are_compatible(
: n_vocab_dft - n_vocab_tgt;
if (vocab_diff > SPEC_VOCAB_MAX_SIZE_DIFFERENCE) {
SPC_DBG("draft model vocab must closely match target model to use speculation but "
SPC_ERR("draft model vocab must closely match target model to use speculation but "
"target vocab size %d does not match draft vocab size %d - difference %d, max allowed %d\n",
n_vocab_tgt, llama_vocab_n_tokens(vocab_dft), vocab_diff, SPEC_VOCAB_MAX_SIZE_DIFFERENCE);
return false;
@@ -114,7 +114,7 @@ static bool common_speculative_are_compatible(
const char * token_text_dft = llama_vocab_get_text(vocab_dft, i);
if (std::strcmp(token_text_tgt, token_text_dft) != 0) {
SPC_DBG("draft model vocab must match target model to use speculation but "
SPC_ERR("draft model vocab must match target model to use speculation but "
"token %d content differs - target '%s', draft '%s'\n", i,
common_token_to_piece(vocab_tgt, i).c_str(),
common_token_to_piece(vocab_dft, i).c_str());
+4 -2
View File
@@ -869,6 +869,7 @@ static bool speculative_state_setup(llama_context * main_ctx, const llama_contex
}
catch(const std::exception & e)
{
common_log_flush(common_log_main());
printf("Error: failed to initialize speculative decoding state: %s\n", e.what());
llama_free(draft_ctx);
draft_ctx = nullptr;
@@ -878,6 +879,7 @@ static bool speculative_state_setup(llama_context * main_ctx, const llama_contex
if(draft_spec == nullptr)
{
common_log_flush(common_log_main());
printf("Error: failed to initialize speculative decoding state.\n");
llama_free(draft_ctx);
draft_ctx = nullptr;
@@ -992,7 +994,7 @@ static void speculative_decoding_setup(std::string spec_model_filename, llama_co
{
if(debugmode==1)
{
printf("WARNING: Draft model vocab of (%d) does not match base vocab of (%d).\nIn debug mode, this restriction is bypassed. However, speculative decoding may malfunction!\n",draftvocab,base_n_vocab);
printf("WARNING: Draft model vocab of (%d) does not match base vocab of (%d).\n",draftvocab,base_n_vocab);
}
else
{
@@ -3482,6 +3484,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
if(!dospam)
{
llama_log_set(currlogger, curruserdat);
common_log_set_verbosity_thold(oldverbosity);
}
printf("Autofit Success: %d, Autofit Result: ",success);
print_fitted_params(model_params,llama_ctx_params);
@@ -3489,7 +3492,6 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
{
//revert to previous
model_params.n_gpu_layers = inputs.gpulayers;
common_log_set_verbosity_thold(oldverbosity);
}
}