vasista22 commited on
Commit
0d0a25c
1 Parent(s): 02d589a

inference_code_snippet_added

Browse files
Files changed (1) hide show
  1. README.md +50 -6
README.md CHANGED
@@ -31,15 +31,58 @@ should probably proofread and complete it, then remove this comment. -->
31
  This model is a fine-tuned version of [openai/whisper-medium](https://huggingface.co/openai/whisper-medium) on the Gujarati data available from multiple publicly available ASR corpuses.
32
  It has been fine-tuned as a part of the Whisper fine-tuning sprint.
33
 
34
- ## Training and evaluation data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
- Training Data: ULCA ASR Corpus, OpenSLR, Microsoft Research Telugu Corpus (Train+Dev), Google/Fleurs Train+Dev set.
 
37
 
38
- Evaluation Data: Google/Fleurs Test set, Microsoft Research Telugu Corpus Test .
39
 
40
- ## Training procedure
 
 
41
 
42
- ### Training hyperparameters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  The following hyperparameters were used during training:
45
  - learning_rate: 1e-05
@@ -53,5 +96,6 @@ The following hyperparameters were used during training:
53
  - mixed_precision_training: True
54
 
55
  ## Acknowledgement
56
- This work was done at Speech Lab, IITM.
 
57
  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.
 
31
  This model is a fine-tuned version of [openai/whisper-medium](https://huggingface.co/openai/whisper-medium) on the Gujarati data available from multiple publicly available ASR corpuses.
32
  It has been fine-tuned as a part of the Whisper fine-tuning sprint.
33
 
34
+ **NOTE:** The code used to train this model is available for re-use in the [whisper-finetune](https://github.com/vasistalodagala/whisper-finetune) repository.
35
+
36
+ ## Usage
37
+
38
+ 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.
39
+
40
+ The same repository also provides the scripts for faster inference using whisper-jax.
41
+
42
+ In order to infer a single audio file using this model, the following code snippet can be used:
43
+
44
+ ```python
45
+ >>> import torch
46
+ >>> from transformers import pipeline
47
+
48
+ >>> # path to the audio file to be transcribed
49
+ >>> audio = "/path/to/audio.format"
50
+ >>> device = "cuda:0" if torch.cuda.is_available() else "cpu"
51
+
52
+ >>> transcribe = pipeline(task="automatic-speech-recognition", model="vasista22/whisper-gujarati-medium", chunk_length_s=30, device=device)
53
+ >>> transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="gu", task="transcribe")
54
 
55
+ >>> print('Transcription: ', transcribe(audio)["text"])
56
+ ```
57
 
58
+ 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:
59
 
60
+ ```python
61
+ >>> import jax.numpy as jnp
62
+ >>> from whisper_jax import FlaxWhisperForConditionalGeneration, FlaxWhisperPipline
63
 
64
+ >>> # path to the audio file to be transcribed
65
+ >>> audio = "/path/to/audio.format"
66
+
67
+ >>> transcribe = FlaxWhisperPipline("vasista22/whisper-gujarati-medium", batch_size=16)
68
+ >>> transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="gu", task="transcribe")
69
+
70
+ >>> print('Transcription: ', transcribe(audio)["text"])
71
+ ```
72
+
73
+ ## Training and evaluation data
74
+
75
+ Training Data:
76
+ - [ULCA ASR Corpus](https://github.com/Open-Speech-EkStep/ULCA-asr-dataset-corpus#gujarati-labelled-total-duration-is-430-hours)
77
+ - [Microsoft Speech Corpus (Indian Languages)](https://msropendata.com/datasets/7230b4b1-912d-400e-be58-f84e0512985e)
78
+ - [Google/Fleurs Train+Dev set](https://huggingface.co/datasets/google/fleurs)
79
+ - [OpenSLR](https://www.openslr.org/78/)
80
+
81
+ Evaluation Data:
82
+ - [Microsoft Speech Corpus (Indian Languages) Test Set](https://msropendata.com/datasets/7230b4b1-912d-400e-be58-f84e0512985e)
83
+ - [Google/Fleurs Test Set](https://huggingface.co/datasets/google/fleurs)
84
+
85
+ ## Training hyperparameters
86
 
87
  The following hyperparameters were used during training:
88
  - learning_rate: 1e-05
 
96
  - mixed_precision_training: True
97
 
98
  ## Acknowledgement
99
+ This work was done at [Speech Lab, IIT Madras](https://asr.iitm.ac.in/).
100
+
101
  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.