Add C++ support for streaming NeMo CTC models. (#857)
This commit is contained in:
@@ -42,6 +42,8 @@ static void PybindOnlineRecognizerResult(py::module *m) {
|
||||
"segment", [](PyClass &self) -> int32_t { return self.segment; })
|
||||
.def_property_readonly(
|
||||
"is_final", [](PyClass &self) -> bool { return self.is_final; })
|
||||
.def("__str__", &PyClass::AsJsonString,
|
||||
py::call_guard<py::gil_scoped_release>())
|
||||
.def("as_json_string", &PyClass::AsJsonString,
|
||||
py::call_guard<py::gil_scoped_release>());
|
||||
}
|
||||
@@ -50,29 +52,17 @@ static void PybindOnlineRecognizerConfig(py::module *m) {
|
||||
using PyClass = OnlineRecognizerConfig;
|
||||
py::class_<PyClass>(*m, "OnlineRecognizerConfig")
|
||||
.def(
|
||||
py::init<const FeatureExtractorConfig &,
|
||||
const OnlineModelConfig &,
|
||||
const OnlineLMConfig &,
|
||||
const EndpointConfig &,
|
||||
const OnlineCtcFstDecoderConfig &,
|
||||
bool,
|
||||
const std::string &,
|
||||
int32_t,
|
||||
const std::string &,
|
||||
float,
|
||||
float,
|
||||
float>(),
|
||||
py::arg("feat_config"),
|
||||
py::arg("model_config"),
|
||||
py::init<const FeatureExtractorConfig &, const OnlineModelConfig &,
|
||||
const OnlineLMConfig &, const EndpointConfig &,
|
||||
const OnlineCtcFstDecoderConfig &, bool, const std::string &,
|
||||
int32_t, const std::string &, float, float, float>(),
|
||||
py::arg("feat_config"), py::arg("model_config"),
|
||||
py::arg("lm_config") = OnlineLMConfig(),
|
||||
py::arg("endpoint_config") = EndpointConfig(),
|
||||
py::arg("ctc_fst_decoder_config") = OnlineCtcFstDecoderConfig(),
|
||||
py::arg("enable_endpoint"),
|
||||
py::arg("decoding_method"),
|
||||
py::arg("max_active_paths") = 4,
|
||||
py::arg("hotwords_file") = "",
|
||||
py::arg("hotwords_score") = 0,
|
||||
py::arg("blank_penalty") = 0.0,
|
||||
py::arg("enable_endpoint"), py::arg("decoding_method"),
|
||||
py::arg("max_active_paths") = 4, py::arg("hotwords_file") = "",
|
||||
py::arg("hotwords_score") = 0, py::arg("blank_penalty") = 0.0,
|
||||
py::arg("temperature_scale") = 2.0)
|
||||
.def_readwrite("feat_config", &PyClass::feat_config)
|
||||
.def_readwrite("model_config", &PyClass::model_config)
|
||||
|
||||
Reference in New Issue
Block a user