From c8f3af885543aff5018a4897909ade8517d820ca Mon Sep 17 00:00:00 2001
From: lyblsgo <lyblsgo@163.com>
Date: 星期二, 21 三月 2023 16:50:30 +0800
Subject: [PATCH] add onnx quantize model for onnx; add tester_rtf
---
funasr/runtime/onnxruntime/tester/tester_rtf.cpp | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/funasr/runtime/onnxruntime/tester/tester_rtf.cpp b/funasr/runtime/onnxruntime/tester/tester_rtf.cpp
index 19c3ec1..9651900 100644
--- a/funasr/runtime/onnxruntime/tester/tester_rtf.cpp
+++ b/funasr/runtime/onnxruntime/tester/tester_rtf.cpp
@@ -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;
+
+ RPASR_HANDLE AsrHanlde=RapidAsrInit(argv[1], nThreadNum, quantize);
if (!AsrHanlde)
{
printf("Cannot load ASR Model from: %s, there must be files model.onnx and vocab.txt", argv[1]);
@@ -88,7 +92,7 @@
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);
return 0;
--
Gitblit v1.9.1