Update README.md
Browse files
README.md
CHANGED
@@ -6,7 +6,26 @@ tags:
|
|
6 |
- speech-recognition
|
7 |
---
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
```python
|
11 |
import faster_whisper
|
12 |
model = faster_whisper.WhisperModel("Finnish-NLP/whisper-large-finnish-v3-ct2")
|
@@ -17,4 +36,5 @@ segments, info = model.transcribe(audio_path, word_timestamps=True, beam_size=5,
|
|
17 |
for segment in segments:
|
18 |
for word in segment.words:
|
19 |
print("[%.2fs -> %.2fs] %s" % (word.start, word.end, word.word))
|
20 |
-
```
|
|
|
|
6 |
- speech-recognition
|
7 |
---
|
8 |
|
9 |
+
Example how to use with WhisperX (https://github.com/m-bain/whisperX)
|
10 |
+
|
11 |
+
```python
|
12 |
+
import whisperx
|
13 |
+
|
14 |
+
device = "cuda"
|
15 |
+
audio_file = "oma_nauhoitus_16Khz.wav"
|
16 |
+
batch_size = 16 # reduce if low on GPU mem
|
17 |
+
compute_type = "float16" # change to "int8" if low on GPU mem (may reduce accuracy)
|
18 |
+
|
19 |
+
# 1. Transcribe with original whisper (batched)
|
20 |
+
model = whisperx.load_model("Finnish-NLP/whisper-large-finnish-v3-ct2", device, compute_type=compute_type)
|
21 |
+
|
22 |
+
audio = whisperx.load_audio(audio_file)
|
23 |
+
result = model.transcribe(audio, batch_size=batch_size)
|
24 |
+
print(result["segments"]) # before alignment
|
25 |
+
```
|
26 |
+
|
27 |
+
|
28 |
+
How to use in Python with faster-whisper (https://github.com/SYSTRAN/faster-whisper)
|
29 |
```python
|
30 |
import faster_whisper
|
31 |
model = faster_whisper.WhisperModel("Finnish-NLP/whisper-large-finnish-v3-ct2")
|
|
|
36 |
for segment in segments:
|
37 |
for word in segment.words:
|
38 |
print("[%.2fs -> %.2fs] %s" % (word.start, word.end, word.word))
|
39 |
+
```
|
40 |
+
|