From 3987276e596356271c5c71263097db5fb63c6438 Mon Sep 17 00:00:00 2001
From: speech_asr <wucong.lyb@alibaba-inc.com>
Date: 星期三, 20 三月 2024 10:49:21 +0800
Subject: [PATCH] add C10_USE_GLOG for paraformer-torch
---
runtime/onnxruntime/bin/funasr-onnx-offline.cpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/runtime/onnxruntime/bin/funasr-onnx-offline.cpp b/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
index 445023d..988787e 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-offline.cpp
@@ -58,6 +58,7 @@
TCLAP::ValueArg<std::string> wav_path("", WAV_PATH, "the input could be: wav_path, e.g.: asr_example.wav; pcm_path, e.g.: asr_example.pcm; wav.scp, kaldi style wav list (wav_id \t wav_path)", true, "", "string");
TCLAP::ValueArg<std::int32_t> audio_fs("", AUDIO_FS, "the sample rate of audio", false, 16000, "int32_t");
TCLAP::ValueArg<std::string> hotword("", HOTWORD, "the hotword file, one hotword perline, Format: Hotword Weight (could be: 闃块噷宸村反 20)", false, "", "string");
+ TCLAP::SwitchArg use_gpu("", INFER_GPU, "Whether to use GPU for inference, default is false", false);
cmd.add(model_dir);
cmd.add(quantize);
@@ -74,6 +75,7 @@
cmd.add(wav_path);
cmd.add(audio_fs);
cmd.add(hotword);
+ cmd.add(use_gpu);
cmd.parse(argc, argv);
std::map<std::string, std::string> model_path;
@@ -90,7 +92,8 @@
struct timeval start, end;
gettimeofday(&start, nullptr);
int thread_num = 1;
- FUNASR_HANDLE asr_hanlde=FunOfflineInit(model_path, thread_num);
+ bool use_gpu_ = use_gpu.getValue();
+ FUNASR_HANDLE asr_hanlde=FunOfflineInit(model_path, thread_num, use_gpu_);
if (!asr_hanlde)
{
@@ -183,7 +186,7 @@
gettimeofday(&start, nullptr);
FUNASR_RESULT result=FunOfflineInferBuffer(asr_hanlde, speech_buff, buff_len, RASR_NONE, nullptr, hotwords_embedding, audio_fs.getValue(), "pcm", true, decoder_handle);
// For debug:end
-
+
// 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);
--
Gitblit v1.9.1