Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

add log for torch

雾聪6a8c595fc3ca
diff --git a/runtime/onnxruntime/src/paraformer-torch.cpp b/runtime/onnxruntime/src/paraformer-torch.cpp
index bdfd0eeb0..7cac2918a 100644
--- a/runtime/onnxruntime/src/paraformer-torch.cpp
+++ b/runtime/onnxruntime/src/paraformer-torch.cpp
@@ -45,8 +45,15 @@ void ParaformerTorch::InitAsr(const std::string &am_model, const std::string &am
#ifdef USE_IPEX
torch::jit::setTensorExprFuserEnabled(false);
#endif
- torch::jit::script::Module model = torch::jit::load(am_model, device);
- model_ = std::make_shared<TorchModule>(std::move(model));
+
+ try {
+ torch::jit::script::Module model = torch::jit::load(am_model, device);
+ model_ = std::make_shared<TorchModule>(std::move(model));
+ LOG(INFO) << "Successfully load model from " << am_model;
+ } catch (std::exception const &e) {
+ LOG(ERROR) << "Error when load am model: " << e.what();
+ exit(-1);
+ }
}
void ParaformerTorch::InitLm(const std::string &lm_file,