Support TDNN models from the yesno recipe from icefall (#262)

This commit is contained in:
Fangjun Kuang
2023-08-12 19:50:22 +08:00
committed by GitHub
parent b094868fb8
commit a4bff28e21
23 changed files with 612 additions and 36 deletions

View File

@@ -15,6 +15,7 @@ void OfflineModelConfig::Register(ParseOptions *po) {
paraformer.Register(po);
nemo_ctc.Register(po);
whisper.Register(po);
tdnn.Register(po);
po->Register("tokens", &tokens, "Path to tokens.txt");
@@ -29,7 +30,8 @@ void OfflineModelConfig::Register(ParseOptions *po) {
po->Register("model-type", &model_type,
"Specify it to reduce model initialization time. "
"Valid values are: transducer, paraformer, nemo_ctc, whisper."
"Valid values are: transducer, paraformer, nemo_ctc, whisper, "
"tdnn."
"All other values lead to loading the model twice.");
}
@@ -56,6 +58,10 @@ bool OfflineModelConfig::Validate() const {
return whisper.Validate();
}
if (!tdnn.model.empty()) {
return tdnn.Validate();
}
return transducer.Validate();
}
@@ -67,6 +73,7 @@ std::string OfflineModelConfig::ToString() const {
os << "paraformer=" << paraformer.ToString() << ", ";
os << "nemo_ctc=" << nemo_ctc.ToString() << ", ";
os << "whisper=" << whisper.ToString() << ", ";
os << "tdnn=" << tdnn.ToString() << ", ";
os << "tokens=\"" << tokens << "\", ";
os << "num_threads=" << num_threads << ", ";
os << "debug=" << (debug ? "True" : "False") << ", ";