Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: ja
|
3 |
+
tags:
|
4 |
+
- audio
|
5 |
+
- automatic-speech-recognition
|
6 |
+
license: apache-2.0
|
7 |
+
---
|
8 |
+
|
9 |
+
# Kotoba-Whisper: kotoba-whisper-v2.0 for Whisper cpp
|
10 |
+
This repository contains the model weights for [kotoba-tech/kotoba-whisper-v2.0](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.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-v2.0`:
|
26 |
+
|
27 |
+
```bash
|
28 |
+
wget https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-ggml/resolve/main/ggml-kotoba-whisper-v2.0.bin -P ./models
|
29 |
+
```
|
30 |
+
|
31 |
+
3. Run inference using the provided sample audio:
|
32 |
+
|
33 |
+
```bash
|
34 |
+
wget https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-ggml/resolve/main/sample_ja_speech.wav
|
35 |
+
make -j && ./main -m models/ggml-kotoba-whisper-v2.0.bin -f sample_ja_speech.wav --output-file transcription --output-json
|
36 |
+
```
|
37 |
+
|
38 |
+
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:
|
39 |
+
```
|
40 |
+
ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav
|
41 |
+
```
|
42 |
+
|
43 |
+
### Benchmark
|
44 |
+
Please refer to the [kotoba-tech/kotoba-whisper-v1.0-ggml](https://huggingface.co/kotoba-tech/kotoba-whisper-v1.0-ggml) for the detail of speed up.
|
45 |
+
|
46 |
+
### Quantized Model
|
47 |
+
To use the quantized model, download the quantized GGML weights:
|
48 |
+
|
49 |
+
```bash
|
50 |
+
wget https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0-ggml/resolve/main/ggml-kotoba-whisper-v2.0-q5_0.bin -P ./models
|
51 |
+
```
|
52 |
+
|
53 |
+
Run inference on the sample audio:
|
54 |
+
```bash
|
55 |
+
make -j && ./main -m models/ggml-kotoba-whisper-v2.0-q5_0.bin -f sample_ja_speech.wav --output-file transcription.quantized --output-json
|
56 |
+
```
|
57 |
+
|
58 |
+
Note that the benchmark results are almost identical to the raw non-quantized model weight.
|
59 |
+
|
60 |
+
### Conversion details
|
61 |
+
The original model was converted with the following command:
|
62 |
+
|
63 |
+
```
|
64 |
+
# clone OpenAI whisper and whisper.cpp
|
65 |
+
git clone https://github.com/openai/whisper
|
66 |
+
git clone https://github.com/ggerganov/whisper.cpp
|
67 |
+
|
68 |
+
# get the models
|
69 |
+
cd whisper.cpp/models
|
70 |
+
git clone https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0
|
71 |
+
|
72 |
+
# convert to ggml
|
73 |
+
python3 ./convert-h5-to-ggml.py ./kotoba-whisper-v2.0/ ../../whisper .
|
74 |
+
mv ggml-model.bin ggml-kotoba-whisper-v2.0
|
75 |
+
|
76 |
+
# quantize ggml model
|
77 |
+
cd ../
|
78 |
+
./quantize models/ggml-kotoba-whisper-v2.0.bin models/ggml-kotoba-whisper-v2.0-q5_0.bin q5_0
|
79 |
+
```
|
80 |
+
|
81 |
+
## Model Details
|
82 |
+
|
83 |
+
For more information about the kotoba-whisper-v2.0, refer to the original [model card](https://huggingface.co/kotoba-tech/kotoba-whisper-v2.0).
|