Description
I have made binding for almost all of the functions and I am trying to get this working in Python but I am encountering errors. Some of this code is different such as paths for the sake of clarity.
`import whisperbind
import sys
from scipy.io import wavfile
import numpy as np
class Whisper():
def __init__(self, model = None, params = None, print_ = False):
if model is None:
model_path = '/whisper.cpp/models/ggml-base.en.bin'
else:
model_path = f'/whisper.cpp/models/ggml-{model}.en.bin'
if params is None:
self.params = whisperbind.whisper_full_default_params(whisperbind.WHISPER_SAMPLING_GREEDY)
if not print_:
self.params.print_progress = False
self.context = whisperbind.whisper_init(model_path)
if not self.context:
print("Context is null")
sys.exit(0)
print(f"Context: {self.context}")
def full(self, samples):
samples_input = samples.astype(np.float32)
if samples_input.ndim == 2:
samples_input = samples_input[:,0]
n_samples = len(samples_input)
return whisperbind.whisper_full(self.context, self.params, samples_input, n_samples)
audio_path = "/whisper/tests/jfk.wav"
sr, audio = wavfile.read(audio_path)
whisper = Whisper()
t = whisper.full(audio)`
When running the full function it seems to never return and breaks in the whisper encode function in C++ on the line ggml_graph_compute (ctxL, &gf);
based on print statement sI have added. I wanted to know if there is something I am missing when trying to call whisper_full or if there is an intermediate step that would cause this issue. Obviously, it might be necessary to see my pybind code, but there isn't much that can't be understood from the python code since most type conversions are automatic except for anything from numpy arrays to vectors/c arrays.