Fix building (#1343)

This commit is contained in:
Fangjun Kuang
2024-09-13 13:33:52 +08:00
committed by GitHub
parent 65cfa7548a
commit 544857b097
17 changed files with 190 additions and 44 deletions

View File

@@ -4,6 +4,8 @@
#include "sherpa-onnx/python/csrc/online-punctuation.h"
#include <string>
#include "sherpa-onnx/csrc/online-punctuation.h"
namespace sherpa_onnx {
@@ -12,9 +14,11 @@ static void PybindOnlinePunctuationModelConfig(py::module *m) {
using PyClass = OnlinePunctuationModelConfig;
py::class_<PyClass>(*m, "OnlinePunctuationModelConfig")
.def(py::init<>())
.def(py::init<const std::string &, const std::string &, int32_t, bool, const std::string &>(),
py::arg("cnn_bilstm"), py::arg("bpe_vocab"), py::arg("num_threads") = 1,
py::arg("debug") = false, py::arg("provider") = "cpu")
.def(py::init<const std::string &, const std::string &, int32_t, bool,
const std::string &>(),
py::arg("cnn_bilstm"), py::arg("bpe_vocab"),
py::arg("num_threads") = 1, py::arg("debug") = false,
py::arg("provider") = "cpu")
.def_readwrite("cnn_bilstm", &PyClass::cnn_bilstm)
.def_readwrite("bpe_vocab", &PyClass::bpe_vocab)
.def_readwrite("num_threads", &PyClass::num_threads)
@@ -30,7 +34,8 @@ static void PybindOnlinePunctuationConfig(py::module *m) {
py::class_<PyClass>(*m, "OnlinePunctuationConfig")
.def(py::init<>())
.def(py::init<const OnlinePunctuationModelConfig &>(), py::arg("model_config"))
.def(py::init<const OnlinePunctuationModelConfig &>(),
py::arg("model_config"))
.def_readwrite("model_config", &PyClass::model)
.def("validate", &PyClass::Validate)
.def("__str__", &PyClass::ToString);
@@ -43,8 +48,8 @@ void PybindOnlinePunctuation(py::module *m) {
py::class_<PyClass>(*m, "OnlinePunctuation")
.def(py::init<const OnlinePunctuationConfig &>(), py::arg("config"),
py::call_guard<py::gil_scoped_release>())
.def("add_punctuation_with_case", &PyClass::AddPunctuationWithCase, py::arg("text"),
py::call_guard<py::gil_scoped_release>());
.def("add_punctuation_with_case", &PyClass::AddPunctuationWithCase,
py::arg("text"), py::call_guard<py::gil_scoped_release>());
}
} // namespace sherpa_onnx