Skip to content

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

adapt to new model struct

雾聪7c11a0d6a84b
diff --git a/runtime/onnxruntime/src/paraformer-torch.cpp b/runtime/onnxruntime/src/paraformer-torch.cpp
index 113d43fcc..a5f719485 100644
--- a/runtime/onnxruntime/src/paraformer-torch.cpp
+++ b/runtime/onnxruntime/src/paraformer-torch.cpp
@@ -16,7 +16,7 @@ ParaformerTorch::ParaformerTorch()
}
// offline
-void ParaformerTorch::InitAsr(const std::string &am_model, const std::string &am_cmvn, const std::string &am_config, int thread_num){
+void ParaformerTorch::InitAsr(const std::string &am_model, const std::string &am_cmvn, const std::string &am_config, const std::string &token_file, int thread_num){
LoadConfigFromYaml(am_config.c_str());
// knf options
fbank_opts_.frame_opts.dither = 0;
@@ -28,8 +28,8 @@ void ParaformerTorch::InitAsr(const std::string &am_model, const std::string &am
fbank_opts_.energy_floor = 0;
fbank_opts_.mel_opts.debug_mel = false;
- vocab = new Vocab(am_config.c_str());
- phone_set_ = new PhoneSet(am_config.c_str());
+ vocab = new Vocab(token_file.c_str());
+ phone_set_ = new PhoneSet(token_file.c_str());
LoadCmvn(am_cmvn.c_str());
torch::DeviceType device = at::kCPU;
diff --git a/runtime/onnxruntime/src/paraformer-torch.h b/runtime/onnxruntime/src/paraformer-torch.h
index e49094dc5..74ac31530 100644
--- a/runtime/onnxruntime/src/paraformer-torch.h
+++ b/runtime/onnxruntime/src/paraformer-torch.h
@@ -42,7 +42,7 @@ namespace funasr {
public:
ParaformerTorch();
~ParaformerTorch();
- void InitAsr(const std::string &am_model, const std::string &am_cmvn, const std::string &am_config, int thread_num);
+ void InitAsr(const std::string &am_model, const std::string &am_cmvn, const std::string &am_config, const std::string &token_file, int thread_num);
void InitHwCompiler(const std::string &hw_model, int thread_num);
void InitSegDict(const std::string &seg_dict_model);
std::vector<std::vector<float>> CompileHotwordEmbedding(std::string &hotwords);