Enable the network half of the HF cache resolver. whisper_hf_resolve_model
now (unless HF_HUB_OFFLINE is set) lists the repo over the HF API, picks the
primary file (exact --hf-file, else first ggml-*.bin), downloads it into the
blobs/<oid> + snapshots/<commit> layout via a slim hf_cache::download_file,
and falls back to the Phase 1 on-disk cache scan on empty listing or network
failure. HF_TOKEN is honored for the Authorization: Bearer header.
HTTPS is gated behind a new WHISPER_OPENSSL CMake option (find_package OpenSSL,
CPPHTTPLIB_OPENSSL_SUPPORT, link OpenSSL::SSL/Crypto); an https attempt in a
non-SSL build prints the rebuild hint.
download_file follows redirects manually and disables httplib url-encoding:
cpp-httplib 0.20 (whisper's vendored version) both mishandles cross-host
redirects and re-encodes the already-encoded signed xet CDN URL, corrupting
the presigned query string into a 403. The bearer token is dropped on
cross-host (CDN) redirects.
tests/test-hf-resolve.sh gains an offline fall-back case (HF_HUB_OFFLINE=1),
a WHISPER_CLI override, and an optional no-OpenSSL rebuild-hint check.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Port llama.cpp's HuggingFace hub-cache subsystem (http.h, hf-cache.{h,cpp})
into whisper.cpp's shared common library and wire -hf/--hf-repo +
-hff/--hf-file into whisper-cli. Phase 1 is cache-only: whisper_hf_resolve_model
scans the on-disk HF hub cache (get_cached_files + finalize_file) and maps
org/repo (+ optional file) to a concrete snapshot path, so a model already
pulled by the hf CLI resolves with no -m path. An explicit -m still wins and
the no-args default stays models/ggml-base.en.bin.
The network download path is compiled but unused this phase (enabled in
Phase 2). Adds tests/test-hf-resolve.sh covering cache hit, missing-file
error (exit 3), -m regression, and the default path.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* ci, examples : add package-lock.json to examples addon node
This commit commits the package-lock.json file for examples/addon.node.
This is needed to make the CI workflow work properly and after we
started pinning the action versions in the workflow, the CI started
failing because the package-lock.json was not committed. At least that
is what I think is happening.
* ci: use node 20.x and 22.x instead of 16.x and 18.x
* fix CMakeLists.txt target properties for addon.node
* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android example
* fix/android-debug-inference-issue: Applied BUILD_TYPE=Release to NDK build of whisper.android.java example
Fixed the -vspd flag for vad_min_speech_duration_ms, to prevent hiding vad_min_silence_duration_ms.
In usage () clarified the output timestamp units.
Fixed a few typos.
Adds a `--version` option to whisper-cli that prints the library version
via `whisper_version()` and exits, plus a corresponding entry in the help
output. Mirrors the existing `-h`/`--help` handling.
Closes#608
* cli : merge tokens split across UTF-8 boundaries in JSON output
When a multi-byte UTF-8 codepoint (most commonly a CJK character, 3 bytes)
is split across multiple whisper tokens, the -ojf/--output-json-full
writer emitted each token's partial bytes as its own JSON string, producing
invalid UTF-8 that chokes downstream parsers.
Merge adjacent tokens in output_json whenever the accumulated text still
ends on an incomplete UTF-8 sequence. The merged entry keeps the first
token's id/p/t_dtw and extends t1 to the last absorbed token, which
matches how segment text is assembled elsewhere.
Refs #1798
* fix: address review — add braces for consistency, use full issue URL
- Add braces to if/else chain for codebase consistency
- Use full URL for issue #1798 reference
Review: @danbev
---------
Co-authored-by: texasich <texasich@users.noreply.github.com>
Co-authored-by: texasich <texasich@gmail.com>
* common: add memory buffer overload of read_audio_data
whisper-server /inference without --convert passed the uploaded file
bytes to read_audio_data as a filename, so ma_decoder_init_file tried
to open a path starting with "RIFF" and failed. every request returned
HTTP 400 "Invalid request" on builds without WHISPER_FFMPEG, which is
the default.
factor the PCM extraction into a shared helper and add an overload that
decodes straight from a memory buffer via ma_decoder_init_memory, which
the function already used for the stdin path. server now calls it with
the upload content. the filename overload behavior is unchanged.
This commit addresses a memory leak in the `read_audio_data` function
where it is currently possible that a call to `ma_decoder_init_file`
succeeds and the function returns early without calling
`ma_decoder_uninit`. A similar situation can occur with
`ma_decoder_init_memory`.
Refs: https://bugs.debian.org/1124796
Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com>
The project moved from ggerganov/ to ggml-org/ and the README already
references the new URL in both places it mentions issue #89 (README.md
and examples/bench/README.md). Syncing the two remaining hardcoded URLs
in examples/bench/bench.cpp and examples/bench.wasm/emscripten.cpp.
The old URL still redirects, so this is cosmetic.
Several error paths in the /inference and /load endpoints returned
HTTP 200 with a JSON error body, making it impossible for clients
to distinguish errors from successful responses by status code.
Set 400 for client errors (missing file field, unreadable audio,
missing/invalid model) and 500 for server errors (ffmpeg conversion
failure). The two existing status-code sites (499 for client
disconnect, 500 for processing failure) are unchanged.
* cmake:
- added `whisper-` prefix to unprefixed targets: `quantize`, `lsp`,
`vad-speech-segments`
- added `install(TARGETS ${TARGET} RUNTIME)` where it was missing
Signed-off-by: Peter A. <ink.splatters@pm.me>
* .github/workflows/build.yml: quantize -> whisper-quantize
Signed-off-by: Peter A. <ink.splatters@pm.me>
---------
Signed-off-by: Peter A. <ink.splatters@pm.me>