replace NULL for onnxruntime/bin
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, speech_buff+sample_offset, step, punc_cache, is_final, |
| | | sampling_rate_, "pcm", (ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | n_total_time += taking_micros; |
| | |
| | | GetValue(asr_mode, ASR_MODE, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = onnx_thread.getValue(); |
| | | int asr_mode_ = -1; |
| | | if(model_path[ASR_MODE] == "offline"){ |
| | |
| | | am_sc = am_scale.getValue(); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | GetValue(asr_mode, ASR_MODE, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = onnx_thread.getValue(); |
| | | int asr_mode_ = -1; |
| | | if(model_path[ASR_MODE] == "offline"){ |
| | |
| | | // init wfst decoder |
| | | FUNASR_DEC_HANDLE decoder_handle = FunASRWfstDecoderInit(tpass_handle, ASR_TWO_PASS, glob_beam, lat_beam, am_sc); |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result = FunTpassInferBuffer(tpass_handle, tpass_online_handle, |
| | | speech_buff+sample_offset, step, punc_cache, is_final, sampling_rate_, "pcm", |
| | | (ASR_TYPE)asr_mode_, hotwords_embedding, true, decoder_handle); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | |
| | |
| | | GetValue(txt_path, TXT_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = 1; |
| | | FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num); |
| | | |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | |
| | | long taking_micros = 0; |
| | | for(auto& txt_str : txt_list){ |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result=CTTransformerInfer(punc_hanlde, txt_str.c_str(), RASR_NONE, NULL); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result=CTTransformerInfer(punc_hanlde, txt_str.c_str(), RASR_NONE, nullptr); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | string msg = FunASRGetResult(result, 0); |
| | |
| | | // warm up |
| | | for (size_t i = 0; i < 1; i++) |
| | | { |
| | | FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[0].c_str(), RASR_NONE, NULL, hotwords_embedding, audio_fs, true, decoder_handle); |
| | | FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[0].c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs, true, decoder_handle); |
| | | if(result){ |
| | | FunASRFreeResult(result); |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[i].c_str(), RASR_NONE, NULL, hotwords_embedding, audio_fs, true, decoder_handle); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result=FunOfflineInfer(asr_handle, wav_list[i].c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs, true, decoder_handle); |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | n_total_time += taking_micros; |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_HANDLE asr_handle=FunOfflineInit(model_path, 1); |
| | | |
| | | if (!asr_handle) |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = 1; |
| | | FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num); |
| | | |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | for (int i = 0; i < wav_list.size(); i++) { |
| | | auto& wav_file = wav_list[i]; |
| | | auto& wav_id = wav_ids[i]; |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result=FsmnVadInfer(vad_hanlde, wav_file.c_str(), NULL, audio_fs.getValue()); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result=FsmnVadInfer(vad_hanlde, wav_file.c_str(), nullptr, audio_fs.getValue()); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = 1; |
| | | FUNASR_HANDLE asr_hanlde=FunOfflineInit(model_path, thread_num); |
| | | |
| | |
| | | LOG(INFO) << "hotword path: " << hotword_path; |
| | | funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_); |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | for (int i = 0; i < wav_list.size(); i++) { |
| | | auto& wav_file = wav_list[i]; |
| | | auto& wav_id = wav_ids[i]; |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, NULL, hotwords_embedding, audio_fs.getValue(), true, decoder_handle); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result=FunOfflineInfer(asr_hanlde, wav_file.c_str(), RASR_NONE, nullptr, hotwords_embedding, audio_fs.getValue(), true, decoder_handle); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = 1; |
| | | FUNASR_HANDLE asr_handle=FunASRInit(model_path, thread_num, ASR_ONLINE); |
| | | |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | |
| | |
| | | GetValue(txt_path, TXT_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = 1; |
| | | FUNASR_HANDLE punc_hanlde=CTTransformerInit(model_path, thread_num, PUNC_ONLINE); |
| | | |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | splitString(vad_strs, txt_str, "|"); |
| | | string str_out; |
| | | FUNASR_RESULT result = nullptr; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | for(auto& vad_str:vad_strs){ |
| | | result=CTTransformerInfer(punc_hanlde, vad_str.c_str(), RASR_NONE, NULL, PUNC_ONLINE, result); |
| | | result=CTTransformerInfer(punc_hanlde, vad_str.c_str(), RASR_NONE, nullptr, PUNC_ONLINE, result); |
| | | if(result){ |
| | | string msg = CTTransformerGetResult(result, 0); |
| | | str_out += msg; |
| | | LOG(INFO)<<"Online result: "<<msg; |
| | | } |
| | | } |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO)<<"Results: "<<str_out; |
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); |
| | | if (result) |
| | | { |
| | | FunASRFreeResult(result); |
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, NULL, is_final, sampling_rate_); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result = FunASRInferBuffer(online_handle, speech_buff+sample_offset, step, RASR_NONE, nullptr, is_final, sampling_rate_); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | n_total_time += taking_micros; |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_HANDLE asr_handle=FunASRInit(model_path, 1, ASR_ONLINE); |
| | | |
| | | if (!asr_handle) |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | GetValue(wav_path, WAV_PATH, model_path); |
| | | |
| | | struct timeval start, end; |
| | | gettimeofday(&start, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | int thread_num = 1; |
| | | FUNASR_HANDLE vad_hanlde=FsmnVadInit(model_path, thread_num); |
| | | |
| | |
| | | exit(-1); |
| | | } |
| | | |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&end, nullptr); |
| | | long seconds = (end.tv_sec - start.tv_sec); |
| | | long modle_init_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | LOG(INFO) << "Model initialization takes " << (double)modle_init_micros / 1000000 << " s"; |
| | |
| | | } else { |
| | | is_final = false; |
| | | } |
| | | gettimeofday(&start, NULL); |
| | | FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, NULL, is_final, sampling_rate_); |
| | | gettimeofday(&end, NULL); |
| | | gettimeofday(&start, nullptr); |
| | | FUNASR_RESULT result = FsmnVadInferBuffer(online_hanlde, speech_buff+sample_offset, step, nullptr, is_final, sampling_rate_); |
| | | gettimeofday(&end, nullptr); |
| | | seconds = (end.tv_sec - start.tv_sec); |
| | | taking_micros += ((seconds * 1000000) + end.tv_usec) - (start.tv_usec); |
| | | |