| 15 | Qwen2VL::Qwen2VL(xrt::device* npu_device_inst) : AutoModel(npu_device_inst, "Qwen2VL") {} |
| 16 | |
| 17 | void Qwen2VL::load_model(std::string model_path, json model_info, int default_context_length, bool enable_preemption) { |
| 18 | this->_shared_load_model(model_path, model_info, default_context_length, enable_preemption); |
| 19 | |
| 20 | this->q4nx = std::make_unique<Q4NX>(this->model_path); |
| 21 | // lm_config->model_type == qwen2 |
| 22 | this->lm_engine = std::make_unique<qwen2vl_npu>(*this->lm_config, this->npu.get(), this->MAX_L); |
| 23 | |
| 24 | this->lm_engine->load_weights(*this->q4nx); |
| 25 | //free the q4nx |
| 26 | this->q4nx.reset(); |
| 27 | this->lm_engine->clear_context(); |
| 28 | this->setup_tokenizer(model_path); |
| 29 | this->sampler.reset(); |
| 30 | |
| 31 | sampler_config config; |
| 32 | config.rep_penalty = 1.05; |
| 33 | config.temperature = 0.6; |
| 34 | config.top_p = 0.8; |
| 35 | config.top_k = 10; |
| 36 | config.rep_penalty_window = 1024; |
| 37 | config.freq_penalty = 1.05; |
| 38 | config.freq_penalty_window = 1024; |
| 39 | this->set_sampler(config); |
| 40 | for (size_t i = 0; i < PROFILER_TYPE_NUM; i++) { |
| 41 | this->profiler_list[i].reset(); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | void Qwen2VL::setup_tokenizer(std::string model_path) { |
| 46 | auto tokenizer_config = this->_shared_setup_tokenizer(model_path); |
nothing calls this directly
no test coverage detected