Begin to support CTC models (#119)
Please see https://k2-fsa.github.io/sherpa/onnx/pretrained_models/offline-ctc/nemo/index.html for a list of pre-trained CTC models from NeMo.
This commit is contained in:
35
sherpa-onnx/csrc/offline-nemo-enc-dec-ctc-model-config.cc
Normal file
35
sherpa-onnx/csrc/offline-nemo-enc-dec-ctc-model-config.cc
Normal file
@@ -0,0 +1,35 @@
|
||||
// sherpa-onnx/csrc/offline-nemo-enc-dec-ctc-model-config.cc
|
||||
//
|
||||
// Copyright (c) 2023 Xiaomi Corporation
|
||||
|
||||
#include "sherpa-onnx/csrc/offline-nemo-enc-dec-ctc-model-config.h"
|
||||
|
||||
#include "sherpa-onnx/csrc/file-utils.h"
|
||||
#include "sherpa-onnx/csrc/macros.h"
|
||||
|
||||
namespace sherpa_onnx {
|
||||
|
||||
void OfflineNemoEncDecCtcModelConfig::Register(ParseOptions *po) {
|
||||
po->Register("nemo-ctc-model", &model,
|
||||
"Path to model.onnx of Nemo EncDecCtcModel.");
|
||||
}
|
||||
|
||||
bool OfflineNemoEncDecCtcModelConfig::Validate() const {
|
||||
if (!FileExists(model)) {
|
||||
SHERPA_ONNX_LOGE("%s does not exist", model.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string OfflineNemoEncDecCtcModelConfig::ToString() const {
|
||||
std::ostringstream os;
|
||||
|
||||
os << "OfflineNemoEncDecCtcModelConfig(";
|
||||
os << "model=\"" << model << "\")";
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
} // namespace sherpa_onnx
|
||||
Reference in New Issue
Block a user