forked from Blendman974/faceclaw
72 lines
3.9 KiB
Markdown
72 lines
3.9 KiB
Markdown
# On-device Whisper French
|
||
|
||
Android Settings → Voice now offers `On-device (Whisper French)` and a separate
|
||
`On-device model: Whisper (French, small)` download (~375 MB decimal). Download
|
||
first, then choose the provider. Recognition stays on the phone; no API key is
|
||
required. This is speech-to-text in French, not translation.
|
||
|
||
This provider always requests `language=fr`, `task=transcribe`, without writing
|
||
the shared language preference. Switching back to existing Moonshine, English
|
||
Whisper or multilingual Whisper restores their previous behavior. Downloads,
|
||
cancellation/resume and deletion reuse the existing model manager and leave
|
||
other model directories untouched. Missing French files do not silently select
|
||
multilingual base. iOS and the Microphones app's separate Moonshine caption
|
||
engine are outside this addition.
|
||
|
||
## Provenance and distribution
|
||
|
||
- Source: https://huggingface.co/bofenghuang/whisper-small-cv11-french
|
||
- Pinned revision: `83d7df2928fb2218721c543dcc0be29ef8db2f96`.
|
||
- The model author's declared license is Apache-2.0; `LICENSE.txt` is distributed
|
||
with the downloadable model. The original Whisper implementation is MIT;
|
||
sherpa-onnx's exporter is Apache-2.0.
|
||
- Exporter: sherpa-onnx v1.13.0 `scripts/whisper/export-onnx.py`.
|
||
- Export: strict tensor-name conversion from HF Whisper to OpenAI Whisper,
|
||
then upstream sherpa tensor-cache export, opset 17, dynamic int8 MatMul.
|
||
- Assets: https://git.undefined-dev.fr/Blendman974/faceclaw/releases/tag/models-whisper-small-fr-v1
|
||
- Model files use the public Gitea generic package registry (`faceclaw-asr`,
|
||
version `whisper-small-fr-v1`), because the encoder and decoder exceed the
|
||
instance’s 100 MB attachment limit. No infrastructure limit is changed.
|
||
- The JSON manifest records file lengths and SHA-256 hashes. Both the source
|
||
checkpoint and exporter are checksum-verified before execution. The existing
|
||
Android downloader checks each downloaded asset against its pinned hash.
|
||
- Only encoder, decoder, vocabulary and license are downloaded to the phone;
|
||
the original checkpoint and unquantized intermediate models are not shipped.
|
||
|
||
## Reproducing the export
|
||
|
||
Use an isolated Python environment with the versions used for this release:
|
||
Python 3.14, torch 2.9.0+cpu (CPU wheel index), openai-whisper 20250625,
|
||
onnx 1.23.2, onnxruntime 1.31.1 and sherpa-onnx 1.13.0. These are development
|
||
requirements only; no Python or additional runtime is added to the app.
|
||
On NixOS expose the host C++ runtime and zlib through LD_LIBRARY_PATH.
|
||
|
||
```sh
|
||
python tools/export-whisper-small-fr.py --output /tmp/whisper-small-fr
|
||
python tools/test-whisper-small-fr.py \
|
||
--model-dir /tmp/whisper-small-fr --wav /path/to/french-test.wav
|
||
```
|
||
|
||
The exporter downloads the pinned source (~484 MB), writes unquantized and
|
||
quantized intermediate models, and produces `manifest.json`. Artifact changes
|
||
require a new versioned release and explicit catalog hash changes; never replace
|
||
v1 assets in place. These scripts do not upload or publish files automatically.
|
||
|
||
## Validation
|
||
|
||
The exported int8 files were actually decoded on CPU with sherpa-onnx 1.13.0,
|
||
the same version used by Android. A public 4.97-second French sample from
|
||
`csukuangfj/sherpa-onnx-nemo-parakeet-tdt-0.6b-v3/test_wavs/fr.wav` produced:
|
||
|
||
> Ne vous demandez pas ce que votre pays peut faire pour vous, demandez-vous plutôt ce que vous pouvez faire pour lui.
|
||
|
||
This is a smoke test, not a recognition-quality benchmark or a measurement of
|
||
Pixel latency. Application tests cover provider persistence, French selection
|
||
without rewriting other languages, switching back, capture sharing, interrupted
|
||
download/resume, file hashes and independent deletion. Kotlin tests cover the
|
||
native file selection and preservation of existing filenames/defaults.
|
||
|
||
Hardware checks remain pending: real French dictation through phone and glasses
|
||
microphones, latency and RAM on the Pixel, airplane-mode use after downloading,
|
||
reconnection and long utterances. No firmware changes are required.
|