Skip to content

Commit c6aa598

Browse files
committed
add temp hack to not use fit with gemma4, rm later
1 parent 66c2437 commit c6aa598

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

tools/server/server-context.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "fit.h"
1212
#include "llama.h"
1313
#include "../../src/llama-ext.h" // staging API: llama_set_mtp_source
14+
#include "ggml-cpp.h"
1415
#include "log.h"
1516
#include "sampling.h"
1617
#include "speculative.h"
@@ -876,11 +877,27 @@ struct server_context_impl {
876877
}
877878
cparams_dft.n_rs_seq = 0;
878879

880+
bool skip_measure = false;
881+
//TODO: remove this
882+
if (spec_mtp && has_draft) {
883+
struct gguf_init_params meta_params = {
884+
/* .no_alloc = */ true,
885+
/* .ctx = */ nullptr,
886+
};
887+
gguf_context_ptr meta(gguf_init_from_file(params_dft.model.path.c_str(), meta_params));
888+
889+
if (std::string(gguf_get_val_str(meta.get(), gguf_find_key(meta.get(), "general.architecture"))) == "gemma4-assistant") {
890+
skip_measure = true;
891+
SRV_WRN("[spec] skipping --fit memory measurement for Gemma 4 assistant draft model '%s'\n",
892+
params_dft.model.path.c_str());
893+
}
894+
}
895+
879896
std::vector<ggml_backend_dev_t> devs;
880897
uint32_t hp_ngl = 0;
881898
uint32_t hp_nct = 0;
882899
uint32_t hp_nex = 0;
883-
try {
900+
if (!skip_measure) try {
884901
auto dmd = common_get_device_memory_data(
885902
params_dft.model.path.c_str(), &mparams_dft, &cparams_dft,
886903
devs, hp_ngl, hp_nct, hp_nex, GGML_LOG_LEVEL_ERROR);

0 commit comments

Comments
 (0)