Automatic Speech Recognition
Transformers
Safetensors
Northern Kurdish
wav2vec2-bert
kurdish
badini
kurmanji
low-resource
Instructions to use computeram/badini-w2v-bert-normalized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use computeram/badini-w2v-bert-normalized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="computeram/badini-w2v-bert-normalized")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForCTC processor = AutoProcessor.from_pretrained("computeram/badini-w2v-bert-normalized") model = AutoModelForCTC.from_pretrained("computeram/badini-w2v-bert-normalized", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,28 +12,60 @@ tags:
|
|
| 12 |
- low-resource
|
| 13 |
base_model: facebook/w2v-bert-2.0
|
| 14 |
pipeline_tag: automatic-speech-recognition
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# Badini Kurdish ASR (Wav2Vec2-BERT)
|
| 18 |
|
| 19 |
An automatic speech recognition (ASR) model for **Badini Kurdish** (a variety of
|
| 20 |
Kurmanji, written in Arabic script), fine-tuned from
|
| 21 |
[`facebook/w2v-bert-2.0`](https://huggingface.co/facebook/w2v-bert-2.0)
|
| 22 |
with a CTC head.
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## Input requirements
|
| 26 |
|
| 27 |
- Audio must be **16 kHz, mono**.
|
| 28 |
-
- Resample any other sample rate to 16 kHz before
|
| 29 |
|
| 30 |
## Usage
|
| 31 |
|
| 32 |
```python
|
| 33 |
import torch, soundfile as sf
|
| 34 |
from transformers import Wav2Vec2BertForCTC, Wav2Vec2BertProcessor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
repo_id = "computeram/badini-w2v-bert"
|
| 37 |
processor = Wav2Vec2BertProcessor.from_pretrained(repo_id)
|
| 38 |
model = Wav2Vec2BertForCTC.from_pretrained(repo_id).eval()
|
| 39 |
|
|
@@ -42,19 +74,15 @@ inputs = processor(speech, sampling_rate=16000, return_tensors="pt")
|
|
| 42 |
with torch.no_grad():
|
| 43 |
logits = model(**inputs).logits
|
| 44 |
pred_ids = torch.argmax(logits, dim=-1)
|
| 45 |
-
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
## Important: text normalization
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
not match the fully normalized transcripts.
|
| 56 |
|
| 57 |
## Intended use
|
| 58 |
|
| 59 |
-
Speech transcription for Badini Kurdish
|
| 60 |
-
|
|
|
|
| 12 |
- low-resource
|
| 13 |
base_model: facebook/w2v-bert-2.0
|
| 14 |
pipeline_tag: automatic-speech-recognition
|
| 15 |
+
metrics:
|
| 16 |
+
- wer
|
| 17 |
+
- cer
|
| 18 |
+
model-index:
|
| 19 |
+
- name: badini-w2v-bert-normalized
|
| 20 |
+
results:
|
| 21 |
+
- task:
|
| 22 |
+
type: automatic-speech-recognition
|
| 23 |
+
metrics:
|
| 24 |
+
- type: wer
|
| 25 |
+
value: 26.53
|
| 26 |
+
name: WER (normalized)
|
| 27 |
+
- type: cer
|
| 28 |
+
value: 11.32
|
| 29 |
+
name: CER (normalized)
|
| 30 |
---
|
| 31 |
|
| 32 |
+
# Badini Kurdish ASR — Normalized (Wav2Vec2-BERT)
|
| 33 |
|
| 34 |
An automatic speech recognition (ASR) model for **Badini Kurdish** (a variety of
|
| 35 |
Kurmanji, written in Arabic script), fine-tuned from
|
| 36 |
[`facebook/w2v-bert-2.0`](https://huggingface.co/facebook/w2v-bert-2.0)
|
| 37 |
with a CTC head.
|
| 38 |
|
| 39 |
+
This repository includes a companion text-normalization module
|
| 40 |
+
(`badini_normalize.py`) alongside the model, so following the usage example
|
| 41 |
+
below gives normalized output: **WER 26.5%, CER 11.3%** on a 1,123-sample
|
| 42 |
+
test set.
|
| 43 |
+
|
| 44 |
+
For the raw acoustic model without normalization (WER 46.5%, CER 12.0% on
|
| 45 |
+
2,038 samples), see
|
| 46 |
+
[computeram/badini-w2v-bert](https://huggingface.co/computeram/badini-w2v-bert).
|
| 47 |
|
| 48 |
## Input requirements
|
| 49 |
|
| 50 |
- Audio must be **16 kHz, mono**.
|
| 51 |
+
- Resample any other sample rate to 16 kHz before inference.
|
| 52 |
|
| 53 |
## Usage
|
| 54 |
|
| 55 |
```python
|
| 56 |
import torch, soundfile as sf
|
| 57 |
from transformers import Wav2Vec2BertForCTC, Wav2Vec2BertProcessor
|
| 58 |
+
from huggingface_hub import hf_hub_download
|
| 59 |
+
import importlib.util
|
| 60 |
+
|
| 61 |
+
repo_id = "computeram/badini-w2v-bert-normalized"
|
| 62 |
+
|
| 63 |
+
# download and load the companion normalization module
|
| 64 |
+
norm_path = hf_hub_download(repo_id, "badini_normalize.py")
|
| 65 |
+
spec = importlib.util.spec_from_file_location("badini_normalize", norm_path)
|
| 66 |
+
badini_normalize = importlib.util.module_from_spec(spec)
|
| 67 |
+
spec.loader.exec_module(badini_normalize)
|
| 68 |
|
|
|
|
| 69 |
processor = Wav2Vec2BertProcessor.from_pretrained(repo_id)
|
| 70 |
model = Wav2Vec2BertForCTC.from_pretrained(repo_id).eval()
|
| 71 |
|
|
|
|
| 74 |
with torch.no_grad():
|
| 75 |
logits = model(**inputs).logits
|
| 76 |
pred_ids = torch.argmax(logits, dim=-1)
|
| 77 |
+
raw_text = processor.batch_decode(pred_ids)[0]
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
# apply the normalization pipeline (punctuation handling, Badini number
|
| 80 |
+
# expansion, character/word-variant unification)
|
| 81 |
+
text = badini_normalize.normalize_transcript(raw_text)
|
| 82 |
+
print(text)
|
| 83 |
+
```
|
|
|
|
| 84 |
|
| 85 |
## Intended use
|
| 86 |
|
| 87 |
+
Speech transcription for Badini Kurdish, with the recommended normalization
|
| 88 |
+
already applied by following the usage example above.
|