ariym / whisper-node

Node.js bindings for OpenAI's Whisper. (C++ CPU version by ggerganov)
https://npmjs.com/whisper-node
MIT License
242 stars 42 forks source link

"npx whisper-node download" downloading a broken file #18

Closed rubengt01 closed 1 year ago

rubengt01 commented 1 year ago

Running "npx whisper-node download" is downloading a broken ggml-base.en.bin file with

Invalid username or password.

This is the logs when I ran npx whisper-node download:

> npx whisper-node download

| Model     | Disk   | RAM     |
|-----------|--------|---------|
| tiny      |  75 MB | ~390 MB |
| tiny.en   |  75 MB | ~390 MB |
| base      | 142 MB | ~500 MB |
| base.en   | 142 MB | ~500 MB |
| small     | 466 MB | ~1.0 GB |
| small.en  | 466 MB | ~1.0 GB |
| medium    | 1.5 GB | ~2.6 GB |
| medium.en | 1.5 GB | ~2.6 GB |
| large-v1  | 2.9 GB | ~4.7 GB |
| large     | 2.9 GB | ~4.7 GB |

[whisper-node] Enter model name (e.g. 'base.en') or 'cancel' to exit
(ENTER for base.en): 
[whisper-node] Going with base.en
Downloading ggml model base.en from 'https://huggingface.co/datasets/ggerganov/whisper.cpp' ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    29  100    29    0     0    207      0 --:--:-- --:--:-- --:--:--   216
Done! Model 'base.en' saved in 'models/ggml-base.en.bin'
You can now use it like this:

  $ ./main -m models/ggml-base.en.bin -f samples/jfk.wav

[whisper-node] Attempting to compile model...
sysctl: unknown oid 'hw.optional.arm64'
I whisper.cpp build info: 
I UNAME_S:  Darwin
I UNAME_P:  i386
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -std=c11   -fPIC -pthread -mf16c -mfma -mavx -mavx2 -DGGML_USE_ACCELERATE
I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -pthread
I LDFLAGS:   -framework Accelerate
I CC:       Apple clang version 14.0.0 (clang-1400.0.29.202)
I CXX:      Apple clang version 14.0.0 (clang-1400.0.29.202)

make: Nothing to be done for `default'.

And this is the error logs for when I try to call whisper(...) with the broken model:

$ tsc && node ./build/test.js
[whisper-node] Transcribing: /Users/ruben/Desktop/audio.mp3 

[whisper-node] No 'modelName' or 'modelPath' provided. Trying default model: base.en 

[whisper-node] Problem: whisper_init_from_file: loading model from './models/ggml-base.en.bin'
whisper_model_load: loading model
whisper_model_load: invalid model data (bad magic)
whisper_init: failed to load model
error: failed to initialize whisper context

undefined
✨  Done in 3.66s.

After copy-pasting the model directly from whisper.cpp repo in /node_modules/whisper-node/lib/whisper.cpp/models/, it worked.

ariym commented 1 year ago

v0.3.0 release includes updated whisper.cpp submodule which has fixed this issue.