MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / load_model

Method load_model

src/common/AutoModel/modeling_gemma3.cpp:13–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11Gemma3::Gemma3(xrt::device* npu_device_inst) : AutoModel(npu_device_inst, "Gemma3") {}
12
13void Gemma3::load_model(std::string model_path, json model_info, int default_context_length, bool enable_preemption) {
14 this->_shared_load_model(model_path, model_info, default_context_length, enable_preemption);
15
16 this->q4nx = std::make_unique<Q4NX>(this->model_path);
17 // model_type == gemma
18 this->lm_engine = std::make_unique<gemma_npu>(*this->lm_config, this->npu.get(), this->MAX_L);
19
20 this->lm_engine->load_weights(*this->q4nx);
21
22 //free the q4nx
23 this->q4nx.reset();
24 this->lm_engine->clear_context();
25 this->setup_tokenizer(model_path);
26 this->sampler.reset();
27
28 sampler_config config;
29 config.top_k = 40;
30 config.top_p = 0.95;
31 config.min_p = 0.1;
32 config.temperature = 0.8;
33 config.rep_penalty = 1.05;
34 config.freq_penalty = 1.05;
35
36 this->set_sampler(config);
37 for (size_t i = 0; i < PROFILER_TYPE_NUM; i++) {
38 this->profiler_list[i].reset();
39 }
40}
41
42void Gemma3::setup_tokenizer(std::string model_path) {
43 auto tokenizer_config = this->_shared_setup_tokenizer(model_path);

Callers

nothing calls this directly

Calls 6

setup_tokenizerMethod · 0.95
clear_contextMethod · 0.80
set_samplerMethod · 0.80
_shared_load_modelMethod · 0.45
getMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected