Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
update fsmn-vad
雾聪453b4f36379f
diff --git a/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp b/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cppindex 2faf56b62..3d3913055 100644--- a/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp+++ b/funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp@@ -44,7 +44,7 @@ int main(int argc, char** argv)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 @@ int main(int argc, char** argv)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.hindex 8734d6d0d..84cdbaf6a 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.cppindex 697828b9f..8ba09c76b 100644--- a/funasr/runtime/onnxruntime/src/fsmn-vad.cpp+++ b/funasr/runtime/onnxruntime/src/fsmn-vad.cpp@@ -148,7 +148,7 @@ void FsmnVad::Forward(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 shapesdiff --git a/funasr/runtime/onnxruntime/src/funasrruntime.cpp b/funasr/runtime/onnxruntime/src/funasrruntime.cppindex 0c79f3c78..991e51687 100644--- a/funasr/runtime/onnxruntime/src/funasrruntime.cpp+++ b/funasr/runtime/onnxruntime/src/funasrruntime.cpp@@ -347,9 +347,9 @@ extern "C" {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.cppindex 91500c30f..48e9079bd 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 @@ class WebsocketClient {jsonresult["is_speaking"] = false;m_client.send(m_hdl, jsonresult.dump(), websocketpp::frame::opcode::text,ec);- // WaitABit();+ WaitABit();}websocketpp::client<T> m_client;