-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4dcf224
commit 4767a27
Showing
5 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,7 @@ set(sources | |
transpose.cc | ||
unbind.cc | ||
utils.cc | ||
vad-model-config.cc | ||
wave-reader.cc | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// sherpa-onnx/csrc/vad-model-config.cc | ||
// | ||
// Copyright (c) 2023 Xiaomi Corporation | ||
|
||
#include "sherpa-onnx/csrc/vad-model-config.h" | ||
|
||
#include <sstream> | ||
#include <string> | ||
|
||
namespace sherpa_onnx { | ||
|
||
void VadModelConfig::Register(ParseOptions *po) { | ||
silero_vad.Register(po); | ||
|
||
po->Register("vad-num-threads", &num_threads, | ||
"Number of threads to run the VAD model"); | ||
|
||
po->Register("vad-provider", &provider, | ||
"Specify a provider to run the VAD model. Supported values: " | ||
"cpu, cuda, coreml"); | ||
} | ||
|
||
bool VadModelConfig::Validate() const { return silero_vad.Validate(); } | ||
|
||
std::string VadModelConfig::ToString() const { | ||
std::ostringstream os; | ||
|
||
os << "VadModelConfig("; | ||
os << "silero_vad=" << silero_vad.ToString() << ", "; | ||
os << "num_threads=" << num_threads << ", "; | ||
os << "provider=\"" << provider << "\")"; | ||
|
||
return os.str(); | ||
} | ||
|
||
} // namespace sherpa_onnx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// sherpa-onnx/csrc/vad-model-config.h | ||
// | ||
// Copyright (c) 2023 Xiaomi Corporation | ||
#ifndef SHERPA_ONNX_CSRC_VAD_MODEL_CONFIG_H_ | ||
#define SHERPA_ONNX_CSRC_VAD_MODEL_CONFIG_H_ | ||
|
||
#include <string> | ||
|
||
#include "sherpa-onnx/csrc/parse-options.h" | ||
#include "sherpa-onnx/csrc/silero-vad-model-config.h" | ||
|
||
namespace sherpa_onnx { | ||
|
||
struct VadModelConfig { | ||
SileroVadModelConfig silero_vad; | ||
|
||
int32_t num_threads = 1; | ||
std::string provider = "cpu"; | ||
|
||
VadModelConfig() = default; | ||
|
||
VadModelConfig(const SileroVadModelConfig &silero_vad, int32_t num_threads, | ||
const std::string &provider) | ||
: silero_vad(silero_vad), num_threads(num_threads), provider(provider) {} | ||
|
||
void Register(ParseOptions *po); | ||
bool Validate() const; | ||
|
||
std::string ToString() const; | ||
}; | ||
|
||
} // namespace sherpa_onnx | ||
|
||
#endif // SHERPA_ONNX_CSRC_VAD_MODEL_CONFIG_H_ |