Update README.md
Browse files
README.md
CHANGED
@@ -2,60 +2,45 @@
|
|
2 |
license: apache-2.0
|
3 |
datasets:
|
4 |
- ARTPARK-IISc/Vaani
|
5 |
-
- google/fleurs
|
6 |
language:
|
7 |
-
-
|
8 |
base_model:
|
9 |
- openai/whisper-small
|
10 |
pipeline_tag: automatic-speech-recognition
|
11 |
---
|
12 |
|
13 |
-
```Python
|
14 |
-
|
15 |
-
import torch
|
16 |
-
from transformers import WhisperForConditionalGeneration, WhisperProcessor, WhisperTokenizer,WhisperFeatureExtractor
|
17 |
-
import soundfile as sf
|
18 |
-
|
19 |
-
|
20 |
-
model="ARTPARK-IISc/whisper-small-vaani-kannada"
|
21 |
-
|
22 |
-
# Load tokenizer and feature extractor individually
|
23 |
-
feature_extractor = WhisperFeatureExtractor.from_pretrained(model)
|
24 |
-
tokenizer = WhisperTokenizer.from_pretrained("openai/whisper-small", language="Kannada", task="transcribe")
|
25 |
|
|
|
26 |
|
27 |
-
|
28 |
-
processor = WhisperProcessor(feature_extractor=feature_extractor, tokenizer=tokenizer)
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
35 |
-
|
36 |
-
# Load the processor and model
|
37 |
-
model = WhisperForConditionalGeneration.from_pretrained(model).to(device)
|
38 |
|
|
|
|
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
resampler = torchaudio.transforms.Resample(orig_freq=sample_rate, new_freq=16000)
|
46 |
-
audio_data = resampler(torch.tensor(audio_data).unsqueeze(0)).squeeze().numpy()
|
47 |
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
with torch.no_grad():
|
54 |
-
predicted_ids = model.generate(input_features)
|
55 |
|
56 |
-
# Decode the generated IDs into human-readable text
|
57 |
-
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
|
58 |
|
59 |
-
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
datasets:
|
4 |
- ARTPARK-IISc/Vaani
|
|
|
5 |
language:
|
6 |
+
- hi
|
7 |
base_model:
|
8 |
- openai/whisper-small
|
9 |
pipeline_tag: automatic-speech-recognition
|
10 |
---
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
# Whisper-small-vaani-kannada
|
14 |
|
15 |
+
This is a fine-tuned version of [OpenAI's Whisper-Small](https://huggingface.co/openai/whisper-small), trained on Kannada speech from multiple datasets.
|
|
|
16 |
|
17 |
+
# Usage
|
18 |
+
This can be used with the pipeline function from the Transformers module.
|
19 |
+
```python
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
import torch
|
22 |
+
from transformers import pipeline
|
23 |
|
24 |
+
audio = "path to the audio file to be transcribed"
|
25 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
26 |
+
modelTags="ARTPARK-IISc/whisper-small-vaani-kannada"
|
27 |
+
transcribe = pipeline(task="automatic-speech-recognition", model=modelTags, chunk_length_s=30, device=device)
|
28 |
+
transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ka", task="transcribe")
|
|
|
|
|
29 |
|
30 |
+
print('Transcription: ', transcribe(audio)["text"])
|
31 |
|
32 |
+
```
|
33 |
+
# Training and Evaluation
|
34 |
|
35 |
+
The models has finetuned using folllowing dataset [Vaani](https://huggingface.co/datasets/ARTPARK-IISc/Vaani) , [Fleurs](https://huggingface.co/datasets/google/fleurs),[IndicTTS](https://huggingface.co/datasets/SPRINGLab/IndicTTS-Hindi)
|
|
|
|
|
36 |
|
|
|
|
|
37 |
|
38 |
+
The performance of the model was evaluated using multiple datasets, and the evaluation results are provided below.
|
39 |
|
40 |
+
| Dataset | WER |
|
41 |
+
| :---: | :---: |
|
42 |
+
| Fleurs | 29.16 |
|
43 |
+
| IndicTTS | 15.27 |
|
44 |
+
| Kathbath | 33.94 |
|
45 |
+
| Kathbath Noisy| 38.46 |
|
46 |
+
| Vaani | 69.78 |
|