From bc723ea200144bd6fa8a5dff4b9a780feda144fc Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期四, 29 六月 2023 18:55:01 +0800
Subject: [PATCH] dcos
---
funasr/runtime/websocket/funasr-wss-server.cpp | 45 ++++++++++++++++++++++++++++++++-------------
1 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/funasr/runtime/websocket/funasr-wss-server.cpp b/funasr/runtime/websocket/funasr-wss-server.cpp
index e479888..5c8aba0 100644
--- a/funasr/runtime/websocket/funasr-wss-server.cpp
+++ b/funasr/runtime/websocket/funasr-wss-server.cpp
@@ -32,31 +32,43 @@
false, "", "string");
TCLAP::ValueArg<std::string> model_dir(
"", MODEL_DIR,
- "default: /workspace/models/asr, the asr model path, which contains model.onnx, config.yaml, am.mvn",
+ "default: /workspace/models/asr, the asr model path, which contains model_quant.onnx, config.yaml, am.mvn",
false, "/workspace/models/asr", "string");
+ TCLAP::ValueArg<std::string> model_revision(
+ "", "model-revision",
+ "ASR model revision",
+ false, "v1.2.1", "string");
TCLAP::ValueArg<std::string> quantize(
"", QUANTIZE,
- "true (Default), load the model of model.onnx in model_dir. If set "
- "true, load the model of model_quant.onnx in model_dir",
+ "true (Default), load the model of model_quant.onnx in model_dir. If set "
+ "false, load the model of model.onnx in model_dir",
false, "true", "string");
TCLAP::ValueArg<std::string> vad_dir(
"", VAD_DIR,
- "default: /workspace/models/vad, the vad model path, which contains model.onnx, vad.yaml, vad.mvn",
+ "default: /workspace/models/vad, the vad model path, which contains model_quant.onnx, vad.yaml, vad.mvn",
false, "/workspace/models/vad", "string");
+ TCLAP::ValueArg<std::string> vad_revision(
+ "", "vad-revision",
+ "VAD model revision",
+ false, "v1.2.0", "string");
TCLAP::ValueArg<std::string> vad_quant(
"", VAD_QUANT,
- "true (Default), load the model of model.onnx in vad_dir. If set "
- "true, load the model of model_quant.onnx in vad_dir",
+ "true (Default), load the model of model_quant.onnx in vad_dir. If set "
+ "false, load the model of model.onnx in vad_dir",
false, "true", "string");
TCLAP::ValueArg<std::string> punc_dir(
"", PUNC_DIR,
- "default: /workspace/models/punc, the punc model path, which contains model.onnx, punc.yaml",
+ "default: /workspace/models/punc, the punc model path, which contains model_quant.onnx, punc.yaml",
false, "/workspace/models/punc",
"string");
+ TCLAP::ValueArg<std::string> punc_revision(
+ "", "punc-revision",
+ "PUNC model revision",
+ false, "v1.1.7", "string");
TCLAP::ValueArg<std::string> punc_quant(
"", PUNC_QUANT,
- "true (Default), load the model of model.onnx in punc_dir. If set "
- "true, load the model of model_quant.onnx in punc_dir",
+ "true (Default), load the model of model_quant.onnx in punc_dir. If set "
+ "false, load the model of model.onnx in punc_dir",
false, "true", "string");
TCLAP::ValueArg<std::string> listen_ip("", "listen-ip", "listen ip", false,
@@ -81,10 +93,13 @@
cmd.add(download_model_dir);
cmd.add(model_dir);
+ cmd.add(model_revision);
cmd.add(quantize);
cmd.add(vad_dir);
+ cmd.add(vad_revision);
cmd.add(vad_quant);
cmd.add(punc_dir);
+ cmd.add(punc_revision);
cmd.add(punc_quant);
cmd.add(listen_ip);
@@ -101,6 +116,10 @@
GetValue(vad_quant, VAD_QUANT, model_path);
GetValue(punc_dir, PUNC_DIR, model_path);
GetValue(punc_quant, PUNC_QUANT, model_path);
+
+ GetValue(model_revision, "model-revision", model_path);
+ GetValue(vad_revision, "vad-revision", model_path);
+ GetValue(punc_revision, "punc-revision", model_path);
// Download model form Modelscope
try{
@@ -122,9 +141,9 @@
std::string s_asr_quant = model_path[QUANTIZE];
std::string s_punc_path = model_path[PUNC_DIR];
std::string s_punc_quant = model_path[PUNC_QUANT];
- std::string python_cmd = "python -m funasr.export.export_model --type onnx --quantize True ";
+ std::string python_cmd = "python -m funasr.utils.runtime_sdk_download_tool --type onnx --quantize True ";
if(vad_dir.isSet() && !s_vad_path.empty()){
- std::string python_cmd_vad = python_cmd + " --model-name " + s_vad_path + " --export-dir " + s_download_model_dir;
+ std::string python_cmd_vad = python_cmd + " --model-name " + s_vad_path + " --export-dir " + s_download_model_dir + " --model_revision " + model_path["vad-revision"];
if(is_download){
LOG(INFO) << "Download model: " << s_vad_path << " from modelscope: ";
}else{
@@ -159,7 +178,7 @@
}
if(model_dir.isSet() && !s_asr_path.empty()){
- std::string python_cmd_asr = python_cmd + " --model-name " + s_asr_path + " --export-dir " + s_download_model_dir;
+ std::string python_cmd_asr = python_cmd + " --model-name " + s_asr_path + " --export-dir " + s_download_model_dir + " --model_revision " + model_path["model-revision"];
if(is_download){
LOG(INFO) << "Download model: " << s_asr_path << " from modelscope: ";
}else{
@@ -194,7 +213,7 @@
}
if(punc_dir.isSet() && !s_punc_path.empty()){
- std::string python_cmd_punc = python_cmd + " --model-name " + s_punc_path + " --export-dir " + s_download_model_dir;
+ std::string python_cmd_punc = python_cmd + " --model-name " + s_punc_path + " --export-dir " + s_download_model_dir + " --model_revision " + model_path["punc-revision"];
if(is_download){
LOG(INFO) << "Download model: " << s_punc_path << " from modelscope: ";
}else{
--
Gitblit v1.9.1