Yabin Li
2023-12-26 b8825902d93d5017e44828316062dc8306b7ddcd
runtime/onnxruntime/src/funasrruntime.cpp
@@ -437,7 +437,7 @@
   _FUNASRAPI FUNASR_RESULT FunTpassInferBuffer(FUNASR_HANDLE handle, FUNASR_HANDLE online_handle, const char* sz_buf, 
                                     int n_len, std::vector<std::vector<std::string>> &punc_cache, bool input_finished, 
                                     int sampling_rate, std::string wav_format, ASR_TYPE mode, 
                                     const std::vector<std::vector<float>> &hw_emb, bool itn)
                                     const std::vector<std::vector<float>> &hw_emb, bool itn, FUNASR_DEC_HANDLE dec_handle)
   {
      funasr::TpassStream* tpass_stream = (funasr::TpassStream*)handle;
      funasr::TpassOnlineStream* tpass_online_stream = (funasr::TpassOnlineStream*)online_handle;
@@ -511,7 +511,12 @@
      // timestamp
      std::string cur_stamp = "[";      
      while(audio->FetchTpass(frame) > 0){
         string msg = ((funasr::Paraformer*)asr_handle)->Forward(frame->data, frame->len, frame->is_final, hw_emb);
         // dec reset
         funasr::WfstDecoder* wfst_decoder = (funasr::WfstDecoder*)dec_handle;
         if (wfst_decoder){
            wfst_decoder->StartUtterance();
         }
         string msg = ((funasr::Paraformer*)asr_handle)->Forward(frame->data, frame->len, frame->is_final, hw_emb, dec_handle);
         std::vector<std::string> msg_vec = funasr::split(msg, '|');  // split with timestamp
         if(msg_vec.size()==0){
@@ -763,7 +768,13 @@
         funasr::Paraformer* paraformer = (funasr::Paraformer*)offline_stream->asr_handle.get();
         if (paraformer->lm_)
            mm = new funasr::WfstDecoder(paraformer->lm_.get(), 
               paraformer->GetPhoneSet(), paraformer->GetVocab(), glob_beam, lat_beam, am_scale);
               paraformer->GetPhoneSet(), paraformer->GetLmVocab(), glob_beam, lat_beam, am_scale);
      } else if (asr_type == ASR_TWO_PASS){
         funasr::TpassStream* tpass_stream = (funasr::TpassStream*)handle;
         funasr::Paraformer* paraformer = (funasr::Paraformer*)tpass_stream->asr_handle.get();
         if (paraformer->lm_)
            mm = new funasr::WfstDecoder(paraformer->lm_.get(),
               paraformer->GetPhoneSet(), paraformer->GetLmVocab(), glob_beam, lat_beam, am_scale);
      }
      return mm;
   }