Add C++ and Python API for Kokoro TTS models. (#1715)

This commit is contained in:
Fangjun Kuang
2025-01-16 14:24:51 +08:00
committed by GitHub
parent 9efe26a646
commit ffc6b480a0
27 changed files with 1193 additions and 29 deletions

View File

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