From 28a19dbc4e85d3b8a4ec2ef7483bba64d422b43f Mon Sep 17 00:00:00 2001
From: aky15 <ankeyu.aky@11.17.44.249>
Date: 星期三, 12 四月 2023 18:03:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/main' into dev_aky
---
funasr/runtime/onnxruntime/tester/tester_rtf.cpp | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/funasr/runtime/onnxruntime/tester/tester_rtf.cpp b/funasr/runtime/onnxruntime/tester/tester_rtf.cpp
index 19c3ec1..dd79887 100644
--- a/funasr/runtime/onnxruntime/tester/tester_rtf.cpp
+++ b/funasr/runtime/onnxruntime/tester/tester_rtf.cpp
@@ -5,7 +5,7 @@
#include <win_func.h>
#endif
-#include "librapidasrapi.h"
+#include "libfunasrapi.h"
#include <iostream>
#include <fstream>
@@ -16,9 +16,9 @@
int main(int argc, char *argv[])
{
- if (argc < 2)
+ if (argc < 4)
{
- printf("Usage: %s /path/to/model_dir /path/to/wav.scp", argv[0]);
+ printf("Usage: %s /path/to/model_dir /path/to/wav.scp quantize(true or false) \n", argv[0]);
exit(-1);
}
@@ -43,7 +43,11 @@
struct timeval start, end;
gettimeofday(&start, NULL);
int nThreadNum = 1;
- RPASR_HANDLE AsrHanlde=RapidAsrInit(argv[1], nThreadNum);
+ // is quantize
+ bool quantize = false;
+ istringstream(argv[3]) >> boolalpha >> quantize;
+
+ FUNASR_HANDLE AsrHanlde=FunASRInit(argv[1], nThreadNum, quantize);
if (!AsrHanlde)
{
printf("Cannot load ASR Model from: %s, there must be files model.onnx and vocab.txt", argv[1]);
@@ -57,7 +61,7 @@
// warm up
for (size_t i = 0; i < 30; i++)
{
- RPASR_RESULT Result=RapidAsrRecogFile(AsrHanlde, wav_list[0].c_str(), RASR_NONE, NULL);
+ FUNASR_RESULT Result=FunASRRecogFile(AsrHanlde, wav_list[0].c_str(), RASR_NONE, NULL);
}
// forward
@@ -68,19 +72,19 @@
for (size_t i = 0; i < wav_list.size(); i++)
{
gettimeofday(&start, NULL);
- RPASR_RESULT Result=RapidAsrRecogFile(AsrHanlde, wav_list[i].c_str(), RASR_NONE, NULL);
+ FUNASR_RESULT Result=FunASRRecogFile(AsrHanlde, wav_list[i].c_str(), RASR_NONE, NULL);
gettimeofday(&end, NULL);
seconds = (end.tv_sec - start.tv_sec);
long taking_micros = ((seconds * 1000000) + end.tv_usec) - (start.tv_usec);
total_time += taking_micros;
if(Result){
- string msg = RapidAsrGetResult(Result, 0);
- printf("Result: %s \n", msg);
+ string msg = FunASRGetResult(Result, 0);
+ printf("Result: %s \n", msg.c_str());
- snippet_time = RapidAsrGetRetSnippetTime(Result);
+ snippet_time = FunASRGetRetSnippetTime(Result);
total_length += snippet_time;
- RapidAsrFreeResult(Result);
+ FunASRFreeResult(Result);
}else{
cout <<"No return data!";
}
@@ -88,8 +92,8 @@
printf("total_time_wav %ld ms.\n", (long)(total_length * 1000));
printf("total_time_comput %ld ms.\n", total_time / 1000);
- printf("Model inference RTF: %05lf.\n", (double)total_time/ (total_length*1000000));
+ printf("total_rtf %05lf .\n", (double)total_time/ (total_length*1000000));
- RapidAsrUninit(AsrHanlde);
+ FunASRUninit(AsrHanlde);
return 0;
}
--
Gitblit v1.9.1