Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pywhispercpp/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ def _init_model(self) -> None:
:return:
"""
logger.info("Initializing the model ...")

with utils.redirect_stderr(to=self.redirect_whispercpp_logs_to):
self._ctx = pw.whisper_init_from_file(self.model_path)
pw.whisper_ctx_init_openvino_encoder(self._ctx)

def _set_params(self, kwargs: dict) -> None:
"""
Expand Down
9 changes: 9 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ int whisper_full_wrapper(
return whisper_full(ctx_w->ptr, params, samples_ptr, n_samples);
}

int whisper_ctx_init_openvino_encoder_wrapper(struct whisper_context_wrapper * ctx_w) {
whisper_ctx_init_openvino_encoder(ctx_w->ptr, nullptr, "CPU", nullptr);
return 0;
}

int whisper_full_parallel_wrapper(
struct whisper_context_wrapper * ctx_w,
struct whisper_full_params params,
Expand Down Expand Up @@ -669,6 +674,10 @@ PYBIND11_MODULE(_pywhispercpp, m) {

////////////////////////////////////////////////////////////////////////////

m.def("whisper_ctx_init_openvino_encoder", &whisper_ctx_init_openvino_encoder_wrapper, "Initialize OpenVINO encoder.");

////////////////////////////////////////////////////////////////////////////

m.def("whisper_bench_memcpy", &whisper_bench_memcpy, "Temporary helpers needed for exposing ggml interface");
m.def("whisper_bench_ggml_mul_mat", &whisper_bench_ggml_mul_mat, "Temporary helpers needed for exposing ggml interface");

Expand Down
Loading