Add C++ runtime for speech enhancement GTCRN models (#1977)

See also https://github.com/Xiaobin-Rong/gtcrn
This commit is contained in:
Fangjun Kuang
2025-03-10 18:11:16 +08:00
committed by GitHub
parent 8aaae91d4a
commit 488a6e687c
20 changed files with 950 additions and 12 deletions

View File

@@ -0,0 +1,40 @@
// sherpa-onnx/csrc/offline-speech-denoiser-model-config.cc
//
// Copyright (c) 2025 Xiaomi Corporation
#include "sherpa-onnx/csrc/offline-speech-denoiser-model-config.h"
#include <string>
namespace sherpa_onnx {
void OfflineSpeechDenoiserModelConfig::Register(ParseOptions *po) {
gtcrn.Register(po);
po->Register("num-threads", &num_threads,
"Number of threads to run the neural network");
po->Register("debug", &debug,
"true to print model information while loading it.");
po->Register("provider", &provider,
"Specify a provider to use: cpu, cuda, coreml");
}
bool OfflineSpeechDenoiserModelConfig::Validate() const {
return gtcrn.Validate();
}
std::string OfflineSpeechDenoiserModelConfig::ToString() const {
std::ostringstream os;
os << "OfflineSpeechDenoiserModelConfig(";
os << "gtcrn=" << gtcrn.ToString() << ", ";
os << "num_threads=" << num_threads << ", ";
os << "debug=" << (debug ? "True" : "False") << ", ";
os << "provider=\"" << provider << "\")";
return os.str();
}
} // namespace sherpa_onnx