Add C++ runtime for Matcha-TTS (#1627)

This commit is contained in:
Fangjun Kuang
2024-12-31 12:44:14 +08:00
committed by GitHub
parent 5c2cc48f50
commit 2c2926af7d
33 changed files with 1397 additions and 86 deletions

View File

@@ -10,6 +10,7 @@ namespace sherpa_onnx {
void OfflineTtsModelConfig::Register(ParseOptions *po) {
vits.Register(po);
matcha.Register(po);
po->Register("num-threads", &num_threads,
"Number of threads to run the neural network");
@@ -27,7 +28,11 @@ bool OfflineTtsModelConfig::Validate() const {
return false;
}
return vits.Validate();
if (!vits.model.empty()) {
return vits.Validate();
}
return matcha.Validate();
}
std::string OfflineTtsModelConfig::ToString() const {
@@ -35,6 +40,7 @@ std::string OfflineTtsModelConfig::ToString() const {
os << "OfflineTtsModelConfig(";
os << "vits=" << vits.ToString() << ", ";
os << "matcha=" << matcha.ToString() << ", ";
os << "num_threads=" << num_threads << ", ";
os << "debug=" << (debug ? "True" : "False") << ", ";
os << "provider=\"" << provider << "\")";