\brief Load a model \param input_list, std::vector
| 406 | /// \brief Load a model |
| 407 | /// \param input_list, std::vector<std::string> |
| 408 | void Runner::cmd_load(std::vector<std::string>& input_list) { |
| 409 | std::string model_name = input_list[1]; |
| 410 | |
| 411 | std::pair<std::string, std::unique_ptr<AutoModel>> auto_model = get_auto_model(model_name, this->supported_models, &this->npu_device_inst); |
| 412 | model_name = auto_model.first; |
| 413 | |
| 414 | if (model_name != this->tag) { |
| 415 | this->tag = model_name; |
| 416 | |
| 417 | if (!this->downloader.is_model_downloaded(this->tag)) { |
| 418 | this->downloader.pull_model(this->tag); |
| 419 | } |
| 420 | auto_chat_engine.reset(); |
| 421 | if(model_name=="gpt-oss:20b") |
| 422 | std::this_thread::sleep_for(std::chrono::milliseconds(2800)); |
| 423 | this->auto_chat_engine = std::move(auto_model.second); |
| 424 | |
| 425 | auto [new_tag, model_info] = this->supported_models.get_model_info(this->tag); |
| 426 | this->auto_chat_engine->configure_parameter("img_pre_resize", this->img_pre_resize); |
| 427 | try { |
| 428 | this->auto_chat_engine->load_model(this->supported_models.get_model_path(new_tag), model_info, this->ctx_length, this->preemption); |
| 429 | } |
| 430 | catch (const std::exception& e) { |
| 431 | header_print("ERROR", "Failed to load model: " + std::string(e.what())); |
| 432 | exit(EXIT_FAILURE); |
| 433 | } |
| 434 | |
| 435 | this->auto_chat_engine->configure_parameter("system_prompt", this->system_prompt); |
| 436 | |
| 437 | } |
| 438 | else |
| 439 | header_print("FLM", "Model already loaded: " << model_name); |
| 440 | |
| 441 | } |
| 442 | |
| 443 | /// \brief Save the history |
| 444 | /// \param input_list, std::vector<std::string> |
no test coverage detected