雾聪
2023-08-09 453b4f36379f0b159c40b335b0512448c7d93718
update fsmn-vad
5个文件已修改
28 ■■■■ 已修改文件
funasr/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/onnxruntime/src/commonfunc.h 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/onnxruntime/src/fsmn-vad.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/onnxruntime/src/funasrruntime.cpp 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/runtime/websocket/funasr-wss-client-2pass.cpp 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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="";
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;
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
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);
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;