From d1c265d3ce427a56a04f2c31b4c3dc3492255562 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 09 八月 2023 11:11:11 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add
---
funasr/runtime/websocket/funasr-wss-client-2pass.cpp | 6 +++---
funasr/runtime/onnxruntime/src/funasrruntime.cpp | 6 +++---
funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp | 4 ++--
funasr/runtime/onnxruntime/src/fsmn-vad.cpp | 2 +-
funasr/runtime/onnxruntime/src/commonfunc.h | 10 +++++-----
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp b/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
index 2faf56b..3d39130 100644
--- a/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
+++ b/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
@@ -44,7 +44,7 @@
TCLAP::CmdLine cmd("funasr-onnx-2pass", ' ', "1.0");
TCLAP::ValueArg<std::string> offline_model_dir("", OFFLINE_MODEL_DIR, "the asr offline model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string");
TCLAP::ValueArg<std::string> online_model_dir("", ONLINE_MODEL_DIR, "the asr online model path, which contains encoder.onnx, decoder.onnx, config.yaml, am.mvn", true, "", "string");
- TCLAP::ValueArg<std::string> quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "false", "string");
+ TCLAP::ValueArg<std::string> quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "true", "string");
TCLAP::ValueArg<std::string> vad_dir("", VAD_DIR, "the vad online model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string");
TCLAP::ValueArg<std::string> vad_quant("", VAD_QUANT, "false (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "true", "string");
TCLAP::ValueArg<std::string> punc_dir("", PUNC_DIR, "the punc online model path, which contains model.onnx, punc.yaml", false, "", "string");
@@ -161,7 +161,7 @@
char* speech_buff = audio.GetSpeechChar();
int buff_len = audio.GetSpeechLen()*2;
- int step = 1600*2;
+ int step = 800*2;
bool is_final = false;
string online_res="";
diff --git a/funasr/runtime/onnxruntime/src/commonfunc.h b/funasr/runtime/onnxruntime/src/commonfunc.h
index 8734d6d..84cdbaf 100644
--- a/funasr/runtime/onnxruntime/src/commonfunc.h
+++ b/funasr/runtime/onnxruntime/src/commonfunc.h
@@ -4,20 +4,20 @@
namespace funasr {
typedef struct
{
- std::string msg;
- std::string tpass_msg;
- float snippet_time;
+ std::string msg="";
+ std::string tpass_msg="";
+ float snippet_time=0;
}FUNASR_RECOG_RESULT;
typedef struct
{
std::vector<std::vector<int>>* segments;
- float snippet_time;
+ float snippet_time=0;
}FUNASR_VAD_RESULT;
typedef struct
{
- string msg;
+ string msg=0;
vector<string> arr_cache;
}FUNASR_PUNC_RESULT;
diff --git a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
index 697828b..8ba09c7 100644
--- a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
+++ b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp
@@ -148,7 +148,7 @@
vad_inputs.size(), vad_out_names_.data(), vad_out_names_.size());
} catch (std::exception const &e) {
LOG(ERROR) << "Error when run vad onnx forword: " << (e.what());
- exit(0);
+ exit(-1);
}
// 5. Change infer result to output shapes
diff --git a/funasr/runtime/onnxruntime/src/funasrruntime.cpp b/funasr/runtime/onnxruntime/src/funasrruntime.cpp
index 0c79f3c..991e516 100644
--- a/funasr/runtime/onnxruntime/src/funasrruntime.cpp
+++ b/funasr/runtime/onnxruntime/src/funasrruntime.cpp
@@ -347,9 +347,9 @@
funasr::FUNASR_RECOG_RESULT* p_result = new funasr::FUNASR_RECOG_RESULT;
p_result->snippet_time = audio->GetTimeLen();
- if(p_result->snippet_time == 0){
- return p_result;
- }
+ // if(p_result->snippet_time == 0){
+ // return p_result;
+ // }
audio->Split(vad_online_handle, chunk_len, input_finished, mode);
diff --git a/funasr/runtime/websocket/funasr-wss-client-2pass.cpp b/funasr/runtime/websocket/funasr-wss-client-2pass.cpp
index 91500c3..48e9079 100644
--- a/funasr/runtime/websocket/funasr-wss-client-2pass.cpp
+++ b/funasr/runtime/websocket/funasr-wss-client-2pass.cpp
@@ -34,9 +34,9 @@
*/
void WaitABit() {
#ifdef WIN32
- Sleep(1000);
+ Sleep(300);
#else
- sleep(1);
+ usleep(300);
#endif
}
std::atomic<int> wav_index(0);
@@ -313,7 +313,7 @@
jsonresult["is_speaking"] = false;
m_client.send(m_hdl, jsonresult.dump(), websocketpp::frame::opcode::text,
ec);
- // WaitABit();
+ WaitABit();
}
websocketpp::client<T> m_client;
--
Gitblit v1.9.1