Skip to content

Commit a9a4eb7

Browse files
committed
feat: usage examples
1 parent 12e1855 commit a9a4eb7

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ The following line will put it on path for the current session. If you use a vir
5959
```
6060
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`python3 -c 'import os; import nvidia.cublas.lib; import nvidia.cudnn.lib; print(os.path.dirname(nvidia.cublas.lib.__file__) + ":" + os.path.dirname(nvidia.cudnn.lib.__file__))'`
6161
```
62+
63+
# Usage Guidance
64+
65+
See [examples](./examples) for how to use the models.

examples/audio.opus

57.7 KB
Binary file not shown.

examples/with_faster_whisper.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Example using faster-whisper with ctranslate2 backend for fast audio transcription.
3+
Run with:
4+
pip install faster-whisper
5+
python with_faster_whisper.py
6+
"""
7+
8+
import faster_whisper
9+
model = faster_whisper.WhisperModel('ivrit-ai/whisper-large-v3-turbo-ct2')
10+
11+
segs, _ = model.transcribe('audio.opus', language='he')
12+
text = ' '.join(s.text for s in segs)
13+
print(f'Transcribed text: {text}')

examples/with_stable_timestamps.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Example of Stable-ts with faster-whisper for fast and accurate transcription.
3+
Run with:
4+
pip install -U 'stable-ts[fw]'
5+
python with_stable_timestamps.py
6+
"""
7+
8+
import stable_whisper
9+
10+
model = stable_whisper.load_faster_whisper('ivrit-ai/whisper-large-v3-turbo-ct2')
11+
segs = model.transcribe('audio.opus', language='he') # Word level timestamps enabled by default
12+
for s in segs:
13+
print(f'{s.start:.2f} - {s.end:.2f}: {s.text}')

examples/with_whisper_cpp.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Example of using whispercpp for fast and lightweight transcription.
3+
Download the model from Hugging Face:
4+
wget https://huggingface.co/ivrit-ai/whisper-large-v3-turbo-ggml/resolve/main/ggml-model.bin
5+
Run with:
6+
pip install pywhispercpp huggingface-hub
7+
python with_whisper_cpp.py
8+
"""
9+
10+
from pywhispercpp.model import Model
11+
from huggingface_hub import hf_hub_download
12+
13+
14+
model_path = hf_hub_download(
15+
repo_id="ivrit-ai/whisper-large-v3-turbo-ggml",
16+
filename="ggml-model.bin"
17+
)
18+
model = Model(model_path)
19+
segs = model.transcribe('audio.opus', language='he')
20+
text = ' '.join(segment.text for segment in segs)
21+
print(f'Transcribed text: {text}')

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
[project]
2+
name = "asr-training"
3+
version = "0.1.0"
4+
description = "ASR training recipes created for ivrit.ai"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
dependencies = []
8+
19
[tool.black]
210
line-length = 120
311

0 commit comments

Comments
 (0)