From 11f0ed89afb2ec16e022cef0ce50d11c534fe028 Mon Sep 17 00:00:00 2001
From: lyblsgo <lyblsgo@163.com>
Date: 星期一, 08 五月 2023 10:56:18 +0800
Subject: [PATCH] fix wavhead reader; modify punc input to int32; add vad/punc/offline-stream apis; modify option parser
---
funasr/runtime/onnxruntime/src/paraformer.h | 16 ++--------------
1 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/paraformer.h b/funasr/runtime/onnxruntime/src/paraformer.h
index f3eb059..3aa7057 100644
--- a/funasr/runtime/onnxruntime/src/paraformer.h
+++ b/funasr/runtime/onnxruntime/src/paraformer.h
@@ -2,9 +2,7 @@
* Copyright FunASR (https://github.com/alibaba-damo-academy/FunASR). All Rights Reserved.
* MIT License (https://opensource.org/licenses/MIT)
*/
-
#pragma once
-
#ifndef PARAFORMER_MODELIMP_H
#define PARAFORMER_MODELIMP_H
@@ -23,9 +21,6 @@
//std::unique_ptr<knf::OnlineFbank> fbank_;
knf::FbankOptions fbank_opts;
- std::unique_ptr<FsmnVad> vad_handle;
- std::unique_ptr<CTTransformer> punc_handle;
-
Vocab* vocab;
vector<float> means_list;
vector<float> vars_list;
@@ -36,7 +31,6 @@
void LoadCmvn(const char *filename);
vector<float> ApplyLfr(const vector<float> &in);
void ApplyCmvn(vector<float> *v);
-
string GreedySearch( float* in, int n_len, int64_t token_nums);
std::shared_ptr<Ort::Session> m_session;
@@ -46,22 +40,16 @@
vector<string> m_strInputNames, m_strOutputNames;
vector<const char*> m_szInputNames;
vector<const char*> m_szOutputNames;
- bool use_vad=false;
- bool use_punc=false;
public:
- Paraformer(std::map<std::string, std::string>& model_path, int thread_num=0);
+ Paraformer();
~Paraformer();
- void InitAM(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, int thread_num);
void Reset();
vector<float> FbankKaldi(float sample_rate, const float* waves, int len);
string ForwardChunk(float* din, int len, int flag);
string Forward(float* din, int len, int flag);
string Rescoring();
- std::vector<std::vector<int>> VadSeg(std::vector<float>& pcm_data);
- string AddPunc(const char* sz_input);
- bool UseVad(){return use_vad;};
- bool UsePunc(){return use_punc;};
};
} // namespace paraformer
--
Gitblit v1.9.1