Update README.md
Browse files
README.md
CHANGED
|
@@ -20,18 +20,6 @@ should probably proofread and complete it, then remove this comment. -->
|
|
| 20 |
|
| 21 |
This model is a fine-tuned version of [openai/whisper-base](https://huggingface.co/openai/whisper-base) on the Common Voice 17.0 dataset.
|
| 22 |
|
| 23 |
-
## Model description
|
| 24 |
-
|
| 25 |
-
More information needed
|
| 26 |
-
|
| 27 |
-
## Intended uses & limitations
|
| 28 |
-
|
| 29 |
-
More information needed
|
| 30 |
-
|
| 31 |
-
## Training and evaluation data
|
| 32 |
-
|
| 33 |
-
More information needed
|
| 34 |
-
|
| 35 |
## Training procedure
|
| 36 |
|
| 37 |
### Training hyperparameters
|
|
@@ -47,9 +35,39 @@ The following hyperparameters were used during training:
|
|
| 47 |
- training_steps: 4000
|
| 48 |
- mixed_precision_training: Native AMP
|
| 49 |
|
| 50 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
|
|
|
|
|
|
| 52 |
|
|
|
|
| 53 |
|
| 54 |
### Framework versions
|
| 55 |
|
|
|
|
| 20 |
|
| 21 |
This model is a fine-tuned version of [openai/whisper-base](https://huggingface.co/openai/whisper-base) on the Common Voice 17.0 dataset.
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
## Training procedure
|
| 24 |
|
| 25 |
### Training hyperparameters
|
|
|
|
| 35 |
- training_steps: 4000
|
| 36 |
- mixed_precision_training: Native AMP
|
| 37 |
|
| 38 |
+
### test results
|
| 39 |
+
|
| 40 |
+
- Best test WER (Word Error Rate): 0.547
|
| 41 |
+
- Best test CER (Character Error Rate): 0.227
|
| 42 |
+
|
| 43 |
+
### Usage
|
| 44 |
+
```python
|
| 45 |
+
import torch
|
| 46 |
+
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
| 47 |
+
|
| 48 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 49 |
+
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
| 50 |
+
|
| 51 |
+
model_id = "aictsharif/whisper-base-fa"
|
| 52 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
| 53 |
+
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
|
| 54 |
+
)
|
| 55 |
+
model.to(device)
|
| 56 |
+
|
| 57 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
| 58 |
+
pipe = pipeline(
|
| 59 |
+
"automatic-speech-recognition",
|
| 60 |
+
model=model,
|
| 61 |
+
tokenizer=processor.tokenizer,
|
| 62 |
+
feature_extractor=processor.feature_extractor,
|
| 63 |
+
torch_dtype=torch_dtype,
|
| 64 |
+
device=device,
|
| 65 |
+
)
|
| 66 |
|
| 67 |
+
result = pipe('sample.mp3')
|
| 68 |
+
print(result["text"])
|
| 69 |
|
| 70 |
+
```
|
| 71 |
|
| 72 |
### Framework versions
|
| 73 |
|