From 01df8f330ccc754223d5e2d688dc0a55d27f2dcc Mon Sep 17 00:00:00 2001
From: querryton <72929808+querryton@users.noreply.github.com>
Date: 星期六, 20 四月 2024 16:07:13 +0800
Subject: [PATCH] [fix] Fix a bug in seaco_paraformer model "inference" function (#1639)
---
runtime/onnxruntime/src/paraformer-online.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/runtime/onnxruntime/src/paraformer-online.cpp b/runtime/onnxruntime/src/paraformer-online.cpp
index d08b57e..55a4fd1 100644
--- a/runtime/onnxruntime/src/paraformer-online.cpp
+++ b/runtime/onnxruntime/src/paraformer-online.cpp
@@ -61,7 +61,11 @@
for(int i=0; i<fsmn_lorder*fsmn_dims; i++){
fsmn_init_cache_.emplace_back(0);
}
- chunk_len = chunk_size[1]*frame_shift*lfr_n*MODEL_SAMPLE_RATE/1000;
+ chunk_len = chunk_size[1]*frame_shift*lfr_n*para_handle_->asr_sample_rate/1000;
+
+ frame_sample_length_ = para_handle_->asr_sample_rate / 1000 * frame_length;
+ frame_shift_sample_length_ = para_handle_->asr_sample_rate / 1000 * frame_shift;
+
}
void ParaformerOnline::FbankKaldi(float sample_rate, std::vector<std::vector<float>> &wav_feats,
@@ -489,7 +493,7 @@
if(is_first_chunk){
is_first_chunk = false;
}
- ExtractFeats(MODEL_SAMPLE_RATE, wav_feats, waves, input_finished);
+ ExtractFeats(para_handle_->asr_sample_rate, wav_feats, waves, input_finished);
if(wav_feats.size() == 0){
return result;
}
--
Gitblit v1.9.1