Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in Electron.js's Node #51

Open
neo773 opened this issue Jan 4, 2025 · 3 comments
Open

Doesn't work in Electron.js's Node #51

neo773 opened this issue Jan 4, 2025 · 3 comments

Comments

@neo773
Copy link

neo773 commented Jan 4, 2025

Hi,

I'm trying to use this in Electron but it fails when transcribing with a vague error, I Googled it but didn't find anything

aheads_masks_init: dtw_n_top must be between 1 and 4 for this model.whisper_init_state: aheads_masks_init() failed for alignment heads masks

I have tried different models and toggling GPU option but no luck so far.

Full log:

whisper_init_from_file_with_params_no_state: loading model from '/Users/neo/.smart-whisper/models/ggml-large-v3-turbo-q8_0.bin'
whisper_init_with_params_no_state: use gpu    = 0
whisper_init_with_params_no_state: flash attn = 0
whisper_init_with_params_no_state: gpu_device = 0
whisper_init_with_params_no_state: dtw        = 16
whisper_model_load: loading model
whisper_model_load: n_vocab       = 51866
whisper_model_load: n_audio_ctx   = 1500
whisper_model_load: n_audio_state = 1280
whisper_model_load: n_audio_head  = 20
whisper_model_load: n_audio_layer = 32
whisper_model_load: n_text_ctx    = 448
whisper_model_load: n_text_state  = 1280
whisper_model_load: n_text_head   = 20
whisper_model_load: n_text_layer  = 4
whisper_model_load: n_mels        = 128
whisper_model_load: ftype         = 7
whisper_model_load: qntvr         = 2
whisper_model_load: type          = 5 (large v3)
whisper_model_load: adding 1609 extra tokens
whisper_model_load: n_langs       = 100
whisper_model_load:      CPU total size =   873.55 MB
whisper_model_load: model size    =  873.55 MB

whisper_print_timings:     load time =   342.46 ms
whisper_print_timings:    total time =   342.48 ms
whisper_init_state: kv self size  =   31.46 MB
whisper_init_state: kv cross size =   31.46 MB
whisper_init_state: kv pad  size  =    7.86 MB
aheads_masks_init: dtw_n_top must be between 1 and 4 for this model.whisper_init_state: aheads_masks_init() failed for alignment heads masks
✨  Done in 10.68s.
@JacobLinCool
Copy link
Owner

hello, can you provide the code and options you used?

@BarrySong97
Copy link

BarrySong97 commented Jan 5, 2025

hello, can you provide the code and options you used?

I have the same issue, I just used example code in electron.

      const pcm = read_wav(audioPath);

      // Initialize Whisper with model and advanced configuration
      this.currentWhisper = new Whisper(modelPath, {
        offload: 10,
        gpu: true, // Enable GPU acceleration if available
      });

      // Start transcription with detailed configuration
      const task = await this.currentWhisper.transcribe(pcm, {
        language: "auto",
      });

My computer is Macbook pro m2 pro.

@BarrySong97
Copy link

BarrySong97 commented Jan 5, 2025

After I modified the code in whisper.cpp, I set dtw_token_timestamps false.
I can use it in a nodejs script, But I can't use it in electron.


it turns out

ggml_gallocr_alloc_graph: reallocating buffers automatically
ggml_gallocr_needs_realloc: node node_27 is not valid
ggml_gallocr_alloc_graph: reallocating buffers automatically

this will terminate my electron app. But when I task.on('transcribe'), It won't be terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants