whisper-cpp-python icon indicating copy to clipboard operation
whisper-cpp-python copied to clipboard

Params max_len doesn't work

Open kaka1909 opened this issue 1 year ago • 0 comments

Thank you for your wonderful work~!!!! This is really remarkable.

But I got a problem, I wanna set the max_len = 1 to get word timing, so I fork the repo, and add the param

class Whisper():
    WHISPER_SR = 16000

    def __init__(self, model_path, strategy=0, n_threads=1, max_len=1):
        self.context = whisper_cpp.whisper_init_from_file(model_path.encode('utf-8'))
        self.params = whisper_cpp.whisper_full_default_params(strategy)
        self.params.n_threads = n_threads
        **self.params.max_len = max_len  # here i add the max_len in to params**
        self.params.print_special = False
        self.params.print_progress = False
        self.params.print_realtime = False
        self.params.print_timestamps = True

But it does not work after I check the output, can you help to figure out the problem? Much thanks

kaka1909 avatar Nov 29 '23 01:11 kaka1909