From 55708e7cebaedefc5f69d61f157993da41848b8f Mon Sep 17 00:00:00 2001
From: lyblsgo <lyblsgo@163.com>
Date: 星期日, 23 四月 2023 19:06:25 +0800
Subject: [PATCH] add offline punc for onnxruntime
---
funasr/runtime/onnxruntime/src/paraformer_onnx.h | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/paraformer_onnx.h b/funasr/runtime/onnxruntime/src/paraformer_onnx.h
index 6442af3..cde2937 100644
--- a/funasr/runtime/onnxruntime/src/paraformer_onnx.h
+++ b/funasr/runtime/onnxruntime/src/paraformer_onnx.h
@@ -4,8 +4,7 @@
#ifndef PARAFORMER_MODELIMP_H
#define PARAFORMER_MODELIMP_H
-#include "kaldi-native-fbank/csrc/feature-fbank.h"
-#include "kaldi-native-fbank/csrc/online-feature.h"
+#include "precomp.h"
namespace paraformer {
@@ -13,6 +12,9 @@
private:
//std::unique_ptr<knf::OnlineFbank> fbank_;
knf::FbankOptions fbank_opts;
+
+ std::unique_ptr<FsmnVad> vadHandle;
+ std::unique_ptr<CTTransformer> puncHandle;
Vocab* vocab;
vector<float> means_list;
@@ -27,22 +29,23 @@
string greedy_search( float* in, int nLen);
- std::unique_ptr<Ort::Session> m_session;
+ std::shared_ptr<Ort::Session> m_session;
Ort::Env env_;
Ort::SessionOptions sessionOptions;
- vector<string> m_strInputNames, m_strOutputNames;
vector<const char*> m_szInputNames;
vector<const char*> m_szOutputNames;
public:
- ModelImp(const char* path, int nNumThread=0, bool quantize=false);
+ ModelImp(const char* path, int nNumThread=0, bool quantize=false, bool use_vad=false);
~ModelImp();
void reset();
vector<float> FbankKaldi(float sample_rate, const float* waves, int len);
string forward_chunk(float* din, int len, int flag);
string forward(float* din, int len, int flag);
string rescoring();
+ std::vector<std::vector<int>> vad_seg(std::vector<float>& pcm_data);
+ string AddPunc(const char* szInput);
};
--
Gitblit v1.9.1