From 76e3e8445a72ece8dd3eb30a129ec141c2746e8a Mon Sep 17 00:00:00 2001 From: lyblsgo Date: Mon, 8 May 2023 11:28:45 +0800 Subject: [PATCH] update readme --- funasr/runtime/onnxruntime/readme.md | 97 ++++++++++++++----- .../onnxruntime/src/funasr-onnx-offline.cpp | 2 +- 2 files changed, 73 insertions(+), 26 deletions(-) diff --git a/funasr/runtime/onnxruntime/readme.md b/funasr/runtime/onnxruntime/readme.md index 95840e530..ab032bf67 100644 --- a/funasr/runtime/onnxruntime/readme.md +++ b/funasr/runtime/onnxruntime/readme.md @@ -40,41 +40,88 @@ make ``` ## Run the demo +### funasr-onnx-offline ```shell ./funasr-onnx-offline [--wav-scp ] [--wav-path ] - [--punc-config ] [--punc-model ] - --am-config --am-cmvn - --am-model [--vad-config ] - [--vad-cmvn ] [--vad-model ] [--] - [--version] [-h] + [--punc-quant ] [--punc-dir ] + [--vad-quant ] [--vad-dir ] + [--quantize ] --model-dir + [--] [--version] [-h] Where: + --model-dir + (required) the asr model path, which contains model.onnx, config.yaml, am.mvn + --quantize + false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir + + --vad-dir + the vad model path, which contains model.onnx, vad.yaml, vad.mvn + --vad-quant + false (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir + + --punc-dir + the punc model path, which contains model.onnx, punc.yaml + --punc-quant + false (Default), load the model of model.onnx in punc_dir. If set true, load the model of model_quant.onnx in punc_dir + + --wav-scp + wave scp path + --wav-path + wave file path + + Required: --model-dir + If use vad, please add: --vad-dir + If use punc, please add: --punc-dir + +For example: +./funasr-onnx-offline \ + --model-dir ./asrmodel/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch \ + --quantize true \ + --vad-dir ./asrmodel/speech_fsmn_vad_zh-cn-16k-common-pytorch \ + --punc-dir ./asrmodel/punc_ct-transformer_zh-cn-common-vocab272727-pytorch \ + --wav-path ./vad_example.wav +``` + +### funasr-onnx-offline-vad +```shell +./funasr-onnx-offline-vad [--wav-scp ] [--wav-path ] + [--quantize ] --model-dir + [--] [--version] [-h] +Where: + --model-dir + (required) the vad model path, which contains model.onnx, vad.yaml, vad.mvn + --quantize + false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir --wav-scp wave scp path --wav-path wave file path - --punc-config - punc config path - --punc-model - punc model path + Required: --model-dir - --am-config - (required) am config path - --am-cmvn - (required) am cmvn path - --am-model - (required) am model path +For example: +./funasr-onnx-offline-vad \ + --model-dir ./asrmodel/speech_fsmn_vad_zh-cn-16k-common-pytorch \ + --wav-path ./vad_example.wav +``` - --vad-config - vad config path - --vad-cmvn - vad cmvn path - --vad-model - vad model path - - Required: --am-config --am-cmvn --am-model - If use vad, please add: [--vad-config ] [--vad-cmvn ] [--vad-model ] - If use punc, please add: [--punc-config ] [--punc-model ] +### funasr-onnx-offline-punc +```shell +./funasr-onnx-offline-punc [--txt-path ] [--quantize ] + --model-dir [--] [--version] [-h] +Where: + --model-dir + (required) the punc model path, which contains model.onnx, punc.yaml + --quantize + false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir + --txt-path + txt file path, one sentence per line + + Required: --model-dir + +For example: +./funasr-onnx-offline-punc \ + --model-dir ./asrmodel/punc_ct-transformer_zh-cn-common-vocab272727-pytorch \ + --txt-path ./punc_example.txt ``` ## Acknowledge diff --git a/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp b/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp index af6d0e3ce..51758a733 100644 --- a/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp +++ b/funasr/runtime/onnxruntime/src/funasr-onnx-offline.cpp @@ -34,7 +34,7 @@ int main(int argc, char** argv) FLAGS_logtostderr = true; TCLAP::CmdLine cmd("funasr-onnx-offline", ' ', "1.0"); - TCLAP::ValueArg model_dir("", MODEL_DIR, "the model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); + TCLAP::ValueArg model_dir("", MODEL_DIR, "the asr model path, which contains model.onnx, config.yaml, am.mvn", true, "", "string"); TCLAP::ValueArg quantize("", QUANTIZE, "false (Default), load the model of model.onnx in model_dir. If set true, load the model of model_quant.onnx in model_dir", false, "false", "string"); TCLAP::ValueArg vad_dir("", VAD_DIR, "the vad model path, which contains model.onnx, vad.yaml, vad.mvn", false, "", "string"); TCLAP::ValueArg vad_quant("", VAD_QUANT, "false (Default), load the model of model.onnx in vad_dir. If set true, load the model of model_quant.onnx in vad_dir", false, "false", "string");