Support RKNN for Zipformer CTC models. (#1948)

This commit is contained in:
Fangjun Kuang
2025-03-02 21:40:13 +08:00
committed by GitHub
parent dfcbc8d40b
commit d5e7b51af5
17 changed files with 819 additions and 114 deletions

View File

@@ -76,6 +76,15 @@ bool OnlineModelConfig::Validate() const {
transducer.decoder.c_str(), transducer.joiner.c_str());
return false;
}
if (!zipformer2_ctc.model.empty() &&
EndsWith(zipformer2_ctc.model, ".rknn")) {
SHERPA_ONNX_LOGE(
"--provider is %s, which is not rknn, but you pass rknn model "
"filename for zipformer2_ctc: '%s'",
provider_config.provider.c_str(), zipformer2_ctc.model.c_str());
return false;
}
}
if (provider_config.provider == "rknn") {
@@ -89,6 +98,15 @@ bool OnlineModelConfig::Validate() const {
transducer.joiner.c_str());
return false;
}
if (!zipformer2_ctc.model.empty() &&
EndsWith(zipformer2_ctc.model, ".onnx")) {
SHERPA_ONNX_LOGE(
"--provider rknn, but you pass onnx model filename for "
"zipformer2_ctc: '%s'",
zipformer2_ctc.model.c_str());
return false;
}
}
if (!tokens_buf.empty() && FileExists(tokens)) {