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

Method ensure_asr_model_loaded

src/server/rest_handler.cpp:417–436  ·  view source on GitHub ↗

@brief Ensure the asr model is loaded @param model_tag the model tag

Source from the content-addressed store, hash-verified

415///@brief Ensure the asr model is loaded
416///@param model_tag the model tag
417void RestHandler::ensure_asr_model_loaded(const std::string& model_tag) {
418#ifndef FASTFLOWLM_LINUX_LIMITED_MODELS
419 std::string ensure_tag = model_tag;
420 if (!downloader.is_model_downloaded(ensure_tag)) {
421 downloader.pull_model(ensure_tag);
422 }
423 this->whisper_engine = std::make_unique<Whisper>(&this->npu_device_inst);
424 auto [new_ensure_tag, whisper_model_info] = this->supported_models.get_model_info(ensure_tag);
425 std::string whisper_model_path = this->supported_models.get_model_path(new_ensure_tag);
426 try {
427 this->whisper_engine->load_model(whisper_model_path, whisper_model_info, this->preemption);
428 }
429 catch (const std::exception& e) {
430 header_print("ERROR", "Failed to load ASR model: " + std::string(e.what()));
431 exit(EXIT_FAILURE);
432 }
433#else
434 throw std::runtime_error("ASR models are not supported in this build");
435#endif
436}
437
438///@brief Ensure the embed model is loaded
439///@param model_tag the model tag

Callers

nothing calls this directly

Calls 5

is_model_downloadedMethod · 0.80
pull_modelMethod · 0.80
get_model_infoMethod · 0.80
get_model_pathMethod · 0.80
load_modelMethod · 0.45

Tested by

no test coverage detected