inference_code_snippet_added
Browse files
README.md
CHANGED
@@ -43,15 +43,58 @@ should probably proofread and complete it, then remove this comment. -->
|
|
43 |
This model is a fine-tuned version of [openai/whisper-large-v2](https://huggingface.co/openai/whisper-large-v2) on the Hindi data available from multiple publicly available ASR corpuses.
|
44 |
It has been fine-tuned as a part of the Whisper fine-tuning sprint.
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
49 |
|
50 |
-
|
51 |
|
52 |
-
|
53 |
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
The following hyperparameters were used during training:
|
57 |
- learning_rate: 0.75e-05
|
@@ -65,4 +108,6 @@ The following hyperparameters were used during training:
|
|
65 |
- mixed_precision_training: True
|
66 |
|
67 |
## Acknowledgement
|
68 |
-
This work was done at Speech Lab,
|
|
|
|
|
|
43 |
This model is a fine-tuned version of [openai/whisper-large-v2](https://huggingface.co/openai/whisper-large-v2) on the Hindi data available from multiple publicly available ASR corpuses.
|
44 |
It has been fine-tuned as a part of the Whisper fine-tuning sprint.
|
45 |
|
46 |
+
**NOTE:** The code used to train this model is available for re-use in the [whisper-finetune](https://github.com/vasistalodagala/whisper-finetune) repository.
|
47 |
|
48 |
+
## Usage
|
49 |
|
50 |
+
In order to evaluate this model on an entire dataset, the evaluation codes available in the [whisper-finetune](https://github.com/vasistalodagala/whisper-finetune) repository can be used.
|
51 |
|
52 |
+
The same repository also provides the scripts for faster inference using whisper-jax.
|
53 |
|
54 |
+
In order to infer a single audio file using this model, the following code snippet can be used:
|
55 |
+
|
56 |
+
```python
|
57 |
+
>>> import torch
|
58 |
+
>>> from transformers import pipeline
|
59 |
+
|
60 |
+
>>> # path to the audio file to be transcribed
|
61 |
+
>>> audio = "/path/to/audio.format"
|
62 |
+
>>> device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
63 |
+
|
64 |
+
>>> transcribe = pipeline(task="automatic-speech-recognition", model="vasista22/whisper-hindi-large-v2", chunk_length_s=30, device=device)
|
65 |
+
>>> transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="hi", task="transcribe")
|
66 |
+
|
67 |
+
>>> print('Transcription: ', transcribe(audio)["text"])
|
68 |
+
```
|
69 |
+
|
70 |
+
For faster inference of whisper models, the [whisper-jax](https://github.com/sanchit-gandhi/whisper-jax) library can be used. Please follow the necessary installation steps as mentioned [here](https://github.com/vasistalodagala/whisper-finetune#faster-evaluation-with-whisper-jax), before using the following code snippet:
|
71 |
+
|
72 |
+
```python
|
73 |
+
>>> import jax.numpy as jnp
|
74 |
+
>>> from whisper_jax import FlaxWhisperForConditionalGeneration, FlaxWhisperPipline
|
75 |
+
|
76 |
+
>>> # path to the audio file to be transcribed
|
77 |
+
>>> audio = "/path/to/audio.format"
|
78 |
+
|
79 |
+
>>> transcribe = FlaxWhisperPipline("vasista22/whisper-hindi-large-v2", batch_size=16)
|
80 |
+
>>> transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="hi", task="transcribe")
|
81 |
+
|
82 |
+
>>> print('Transcription: ', transcribe(audio)["text"])
|
83 |
+
```
|
84 |
+
|
85 |
+
## Training and evaluation data
|
86 |
+
|
87 |
+
Training Data:
|
88 |
+
- [GramVaani ASR Corpus](https://sites.google.com/view/gramvaaniasrchallenge/dataset?authuser=0)
|
89 |
+
- [ULCA ASR Corpus](https://github.com/Open-Speech-EkStep/ULCA-asr-dataset-corpus#hindi-labelled--total-duration-is-239876-hours)
|
90 |
+
- [Shrutilipi ASR Corpus](https://ai4bharat.org/shrutilipi)
|
91 |
+
- [Google/Fleurs Train+Dev set](https://huggingface.co/datasets/google/fleurs)
|
92 |
+
|
93 |
+
Evaluation Data:
|
94 |
+
- [GramVaani ASR Corpus Test Set](https://sites.google.com/view/gramvaaniasrchallenge/dataset?authuser=0)
|
95 |
+
- [Google/Fleurs Test Set](https://huggingface.co/datasets/google/fleurs)
|
96 |
+
|
97 |
+
## Training hyperparameters
|
98 |
|
99 |
The following hyperparameters were used during training:
|
100 |
- learning_rate: 0.75e-05
|
|
|
108 |
- mixed_precision_training: True
|
109 |
|
110 |
## Acknowledgement
|
111 |
+
This work was done at [Speech Lab, IIT Madras](https://asr.iitm.ac.in/).
|
112 |
+
|
113 |
+
The compute resources for this work were funded by "Bhashini: National Language translation Mission" project of the Ministry of Electronics and Information Technology (MeitY), Government of India.
|