Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,58 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# PhoWhisper-large-ct2
|
2 |
+
|
3 |
+
This repository contains the PhoWhisper-large model converted to use CTranslate2 for faster inference. This allows for significant performance improvements, especially on CPU.
|
4 |
+
|
5 |
+
## Usage
|
6 |
+
|
7 |
+
1. **Installation:**
|
8 |
+
Ensure you have the necessary libraries installed:
|
9 |
+
```bash
|
10 |
+
pip install transformers ctranslate2 faster-whisper
|
11 |
+
```
|
12 |
+
|
13 |
+
2. **Conversion (only needed once):**
|
14 |
+
This step converts the original Hugging Face model to the CTranslate2 format.
|
15 |
+
|
16 |
+
```bash
|
17 |
+
ct2-transformers-converter --model vinai/PhoWhisper-large --output_dir PhoWhisper-large-ct2 --copy_files tokenizer_config.json --quantization float16
|
18 |
+
```
|
19 |
+
|
20 |
+
3. **Transcription:**
|
21 |
+
|
22 |
+
```python
|
23 |
+
import os
|
24 |
+
from faster_whisper import WhisperModel
|
25 |
+
|
26 |
+
model_size = "kiendt/PhoWhisper-large-ct2"
|
27 |
+
# Run on GPU with FP16
|
28 |
+
model = WhisperModel(model_size, device="cuda", compute_type="float16")
|
29 |
+
|
30 |
+
# or run on GPU with INT8
|
31 |
+
# model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
|
32 |
+
# or run on CPU with INT8
|
33 |
+
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
34 |
+
|
35 |
+
segments, info = model.transcribe("audio.wav", beam_size=5) # Replace audio.wav with your audio file
|
36 |
+
|
37 |
+
print("Detected language '%s' with probability %f" % (info.language, info.language_probability))
|
38 |
+
|
39 |
+
for segment in segments:
|
40 |
+
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
|
41 |
+
```
|
42 |
+
|
43 |
+
|
44 |
+
## Model Details
|
45 |
+
|
46 |
+
* Based on the `vinai/PhoWhisper-large` model.
|
47 |
+
* Converted using `ct2-transformers-converter`.
|
48 |
+
* Optimized for faster inference with CTranslate2.
|
49 |
+
|
50 |
+
|
51 |
+
## Contributing
|
52 |
+
|
53 |
+
Contributions are welcome! Please open an issue or submit a pull request.
|
54 |
+
|
55 |
+
|
56 |
+
## License
|
57 |
+
|
58 |
+
MIT
|