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

Method load_model

src/common/AutoModel/modeling_gpt_oss.cpp:12–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected