Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🗣️ Speech-to-Text Model: Whisper Small (openai/whisper-small)
|
| 2 |
+
|
| 3 |
+
This repository demonstrates how to fine-tune, evaluate, quantize, and deploy the [OpenAI Whisper Small](https://huggingface.co/openai/whisper-small) model for automatic speech recognition (ASR).
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 📦 Model Used
|
| 8 |
+
|
| 9 |
+
- **Model Name**: `openai/whisper-small`
|
| 10 |
+
- **Architecture**: Transformer-based encoder-decoder
|
| 11 |
+
- **Task**: Automatic Speech Recognition (ASR)
|
| 12 |
+
- **Pretrained by**: OpenAI
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## 🧾 Dataset
|
| 17 |
+
|
| 18 |
+
We use the [common_voice](https://huggingface.co/datasets/mozilla-foundation/common_voice_13_0) dataset from Hugging Face.
|
| 19 |
+
|
| 20 |
+
### 🔹 Load English Subset:
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
from datasets import load_dataset
|
| 24 |
+
dataset = load_dataset("mozilla-foundation/common_voice_13_0", "en", split="train[:1%]")
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
# 🧠 Evaluation / Scoring (WER)
|
| 28 |
+
```python
|
| 29 |
+
|
| 30 |
+
from datasets import load_metric
|
| 31 |
+
import numpy as np
|
| 32 |
+
|
| 33 |
+
wer_metric = load_metric("wer")
|
| 34 |
+
|
| 35 |
+
def compute_wer(predictions, references):
|
| 36 |
+
return wer_metric.compute(predictions=predictions, references=references)
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
# 🎤 Inference Example
|
| 40 |
+
```python
|
| 41 |
+
|
| 42 |
+
from transformers import pipeline
|
| 43 |
+
|
| 44 |
+
pipe = pipeline("automatic-speech-recognition", model="./Speech_To_Text_OpenAIWhisper_Model", device=0)
|
| 45 |
+
|
| 46 |
+
result = pipe("harvard.wav")
|
| 47 |
+
print("Transcription:", result["text"])
|
| 48 |
+
```
|
| 49 |
+
|