Edit model card

Kotoba-Whisper-Bilingual: kotoba-whisper-bilingual-v1.0 for Whisper cpp

This repository contains the model weights for kotoba-tech/kotoba-whisper-bilingual-v1.0 converted to GGML format. GGML is the weight format expected by C/C++ packages such as Whisper.cpp, for which we provide an example below.

Usage

Kotoba-Whisper can be run with the Whisper.cpp package with the original sequential long-form transcription algorithm.

Steps for getting started:

  1. Clone the Whisper.cpp repository:
git clone https://github.com/ggerganov/whisper.cpp.git
cd whisper.cpp
make
  1. Download the GGML weights for kotoba-tech/kotoba-whisper-bilingual-v1.0:
wget https://huggingface.co/kotoba-tech/kotoba-whisper-bilingual-v1.0-ggml/resolve/main/ggml-kotoba-whisper-bilingual-v1.0.bin -P ./models
  1. Run inference using the provided sample audio:
  • Download sample audio. Note that it runs only with 16-bit WAV files, so make sure to convert your input before running the tool. For example, you can use ffmpeg like below.
wget https://huggingface.co/datasets/japanese-asr/en_asr.esb_eval/resolve/main/sample.wav -O sample_en.wav
wget https://huggingface.co/datasets/japanese-asr/ja_asr.jsut_basic5000/resolve/main/sample.flac -O sample_ja.flac
ffmpeg -i sample_en.wav -ar 16000 -ac 1 -c:a pcm_s16le sample_en_fixed.wav
ffmpeg -i sample_ja.flac -ar 16000 -ac 1 -c:a pcm_s16le sample_ja_fixed.wav
  • Japanese ASR
make -j && ./main -m models/ggml-kotoba-whisper-bilingual-v1.0.bin -l ja -f sample_ja_fixed.wav --output-file "output.transcribe.ja" --output-json 
  • English ASR
make -j && ./main -m models/ggml-kotoba-whisper-bilingual-v1.0.bin -l ja -f sample_en_fixed.wav --output-file "output.transcribe.en" --output-json 
  • Japanese (speech) to English (text) Translation
make -j && ./main -m models/ggml-kotoba-whisper-bilingual-v1.0.bin -tr -l en -f sample_ja_fixed.wav --output-file "output.translate.en" --output-json 
  • English (speech) to Japanese (text) Translation
make -j && ./main -m models/ggml-kotoba-whisper-bilingual-v1.0.bin -tr -l ja -f sample_en_fixed.wav --output-file "output.translate.ja" --output-json 

Benchmark

We measure the inference speed of different kotoba-whisper-v2.0 implementations with four different Japanese speech audio on MacBook Pro with the following spec:

  • Apple M2 Pro
  • 32GB
  • 14-inch, 2023
  • OS Sonoma Version 14.4.1 (23E224)
audio file audio duration (min) whisper.cpp (sec) faster-whisper (sec) hf pipeline (sec)
audio 1 50.3 581 2601 807
audio 2 5.6 41 73 61
audio 3 4.9 30 141 54
audio 4 5.6 35 126 69

Scripts to re-run the experiment can be found bellow:

Currently whisper.cpp and faster-whisper support the sequential long-form decoding, and only Huggingface pipeline supports the chunked long-form decoding, which we empirically found better than the sequnential long-form decoding.

Quantized Model

To use the quantized model, download the quantized GGML weights:

wget https://huggingface.co/kotoba-tech/kotoba-whisper-bilingual-v1.0-ggml/resolve/main/ggml-kotoba-whisper-bilingual-v1.0-q5_0.bin -P ./models

Run inference on the sample audio:

make -j && ./main -m models/ggml-kotoba-whisper-bilingual-v1.0-q5_0.bin -l ja -f sample_ja_fixed.wav --output-file "output.transcribe.ja.q" --output-json 

Note that the benchmark results are almost identical to the raw non-quantized model weight.

Conversion details

The original model was converted with the following command:

# clone OpenAI whisper and whisper.cpp
git clone https://github.com/openai/whisper
git clone https://github.com/ggerganov/whisper.cpp

# get the models
cd whisper.cpp/models
git clone https://huggingface.co/kotoba-tech/kotoba-whisper-bilingual-v1.0

# convert to ggml
python3 ./convert-h5-to-ggml.py ./kotoba-whisper-bilingual-v1.0/ ../../whisper .
mv ggml-model.bin ggml-kotoba-whisper-bilingual-v1.0.bin

# quantize ggml model
cd ../
make quantize
./quantize models/ggml-kotoba-whisper-bilingual-v1.0.bin models/ggml-kotoba-whisper-bilingual-v1.0-q5_0.bin q5_0

Model Details

For more information about the kotoba-whisper-v2.0, refer to the original model card.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Examples
Unable to determine this model's library. Check the docs .

Collection including kotoba-tech/kotoba-whisper-bilingual-v1.0-ggml