asahi417 commited on
Commit
bef4f52
·
verified ·
1 Parent(s): e768fb8

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: ja
3
+ tags:
4
+ - audio
5
+ - automatic-speech-recognition
6
+ license: apache-2.0
7
+ ---
8
+
9
+ # Kotoba-Whisper-Bilingual: kotoba-whisper-bilingual-v1.0 for Whisper cpp
10
+ This repository contains the model weights for [kotoba-tech/kotoba-whisper-bilingual-v1.0](https://huggingface.co/kotoba-tech/kotoba-whisper-bilingual-v1.0)
11
+ converted to [GGML](https://github.com/ggerganov/ggml) format. GGML is the weight format expected by C/C++ packages
12
+ such as [Whisper.cpp](https://github.com/ggerganov/whisper.cpp), for which we provide an example below.
13
+
14
+ ## Usage
15
+ Kotoba-Whisper can be run with the [Whisper.cpp](https://github.com/ggerganov/whisper.cpp) package with the original
16
+ sequential long-form transcription algorithm.
17
+
18
+ Steps for getting started:
19
+
20
+ 1. Clone the Whisper.cpp repository:
21
+ ```
22
+ git clone https://github.com/ggerganov/whisper.cpp.git
23
+ cd whisper.cpp
24
+ ```
25
+ 2. Download the GGML weights for `kotoba-tech/kotoba-whisper-bilingual-v1.0`:
26
+
27
+ ```bash
28
+ wget https://huggingface.co/kotoba-tech/kotoba-whisper-bilingual-v1.0-ggml/resolve/main/ggml-kotoba-whisper-bilingual-v1.0.bin -P ./models
29
+ ```
30
+
31
+ 3. Run inference using the provided sample audio:
32
+
33
+ ```bash
34
+ wget https://huggingface.co/datasets/japanese-asr/en_asr.esb_eval/resolve/main/sample.wav -O sample_en.wav
35
+ wget https://huggingface.co/datasets/japanese-asr/ja_asr.jsut_basic5000/resolve/main/sample.flac -O sample_ja.flac
36
+
37
+
38
+ make -j && ./main -m models/ggml-kotoba-whisper-v2.0.bin -l ja -f sample_ja_speech.wav --output-file transcription --output-json
39
+ ```
40
+
41
+ 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 this:
42
+ ```
43
+ ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav
44
+ ```
45
+
46
+ ### Benchmark
47
+ 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:
48
+ - Apple M2 Pro
49
+ - 32GB
50
+ - 14-inch, 2023
51
+ - OS Sonoma Version 14.4.1 (23E224)
52
+
53
+ | audio file | audio duration (min)| [whisper.cpp](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-ggml) (sec) | [faster-whisper](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-faster) (sec)| [hf pipeline](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0) (sec)
54
+ |--------|------|-----|------|-----|
55
+ |audio 1 | 50.3 | 581 | 2601 | 807 |
56
+ |audio 2 | 5.6 | 41 | 73 | 61 |
57
+ |audio 3 | 4.9 | 30 | 141 | 54 |
58
+ |audio 4 | 5.6 | 35 | 126 | 69 |
59
+
60
+ Scripts to re-run the experiment can be found bellow:
61
+ * [whisper.cpp](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-ggml/blob/main/benchmark.sh)
62
+ * [faster-whisper](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-faster/blob/main/benchmark.sh)
63
+ * [hf pipeline](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0/blob/main/benchmark.sh)
64
+ Also, currently whisper.cpp and faster-whisper support the [sequential long-form decoding](https://huggingface.co/distil-whisper/distil-large-v3#sequential-long-form),
65
+ and only Huggingface pipeline supports the [chunked long-form decoding](https://huggingface.co/distil-whisper/distil-large-v3#chunked-long-form), which we empirically
66
+ found better than the sequnential long-form decoding.
67
+
68
+ ### Quantized Model
69
+ To use the quantized model, download the quantized GGML weights:
70
+
71
+ ```bash
72
+ wget https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-ggml/resolve/main/ggml-kotoba-whisper-v2.0-q5_0.bin -P ./models
73
+ ```
74
+
75
+ Run inference on the sample audio:
76
+ ```bash
77
+ make -j && ./main -m models/ggml-kotoba-whisper-v2.0-q5_0.bin -l ja -f sample_ja_speech.wav --output-file transcription.quantized --output-json
78
+ ```
79
+
80
+ Note that the benchmark results are almost identical to the raw non-quantized model weight.
81
+
82
+ ### Conversion details
83
+ The original model was converted with the following command:
84
+
85
+ ```
86
+ # clone OpenAI whisper and whisper.cpp
87
+ git clone https://github.com/openai/whisper
88
+ git clone https://github.com/ggerganov/whisper.cpp
89
+
90
+ # get the models
91
+ cd whisper.cpp/models
92
+ git clone https://huggingface.co/kotoba-tech/kotoba-whisper-bilingual-v1.0
93
+
94
+ # convert to ggml
95
+ python3 ./convert-h5-to-ggml.py ./kotoba-whisper-bilingual-v1.0/ ../../whisper .
96
+ mv ggml-model.bin ggml-kotoba-whisper-bilingual-v1.0.bin
97
+
98
+ # quantize ggml model
99
+ cd ../
100
+ make quantize
101
+ ./quantize models/ggml-kotoba-whisper-bilingual-v1.0.bin models/ggml-kotoba-whisper-bilingual-v1.0-q5_0.bin q5_0
102
+ ```
103
+
104
+ ## Model Details
105
+
106
+ For more information about the kotoba-whisper-v2.0, refer to the original [model card](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0).