ArashAzma commited on
Commit
e595247
·
verified ·
1 Parent(s): 15138f0

update README

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/base_common-voice.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - zh
5
+ - de
6
+ - es
7
+ - ru
8
+ - ko
9
+ - fr
10
+ - ja
11
+ - pt
12
+ - tr
13
+ - pl
14
+ - ca
15
+ - nl
16
+ - ar
17
+ - sv
18
+ - it
19
+ - id
20
+ - hi
21
+ - fi
22
+ - vi
23
+ - he
24
+ - uk
25
+ - el
26
+ - ms
27
+ - cs
28
+ - ro
29
+ - da
30
+ - hu
31
+ - ta
32
+ - no
33
+ - th
34
+ - ur
35
+ - hr
36
+ - bg
37
+ - lt
38
+ - la
39
+ - mi
40
+ - ml
41
+ - cy
42
+ - sk
43
+ - te
44
+ - fa
45
+ - lv
46
+ - bn
47
+ - sr
48
+ - az
49
+ - sl
50
+ - kn
51
+ - et
52
+ - mk
53
+ - br
54
+ - eu
55
+ - is
56
+ - hy
57
+ - ne
58
+ - mn
59
+ - bs
60
+ - kk
61
+ - sq
62
+ - sw
63
+ - gl
64
+ - mr
65
+ - pa
66
+ - si
67
+ - km
68
+ - sn
69
+ - yo
70
+ - so
71
+ - af
72
+ - oc
73
+ - ka
74
+ - be
75
+ - tg
76
+ - sd
77
+ - gu
78
+ - am
79
+ - yi
80
+ - lo
81
+ - uz
82
+ - fo
83
+ - ht
84
+ - ps
85
+ - tk
86
+ - nn
87
+ - mt
88
+ - sa
89
+ - lb
90
+ - my
91
+ - bo
92
+ - tl
93
+ - mg
94
+ - as
95
+ - tt
96
+ - haw
97
+ - ln
98
+ - ha
99
+ - ba
100
+ - jw
101
+ - su
102
+ tags:
103
+ - audio
104
+ - automatic-speech-recognition
105
+ - open-persian-asr-leaderboard
106
+ pipeline_tag: automatic-speech-recognition
107
+ license: apache-2.0
108
+ ---
109
+
110
+ # C1Tech/whisper_base_persian
111
+
112
+ *C1Tech/whisper_base_persian* is a Persian ASR model based on Whisper architecture, fine-tuned on a large scale custom persian dataset.
113
+
114
+ With only 74 million parameters, this model achieves state-of-the-art performance on Persian ASR tasks, outperforming larger models like openai Whisper Large-v3 (1550M parameters) and Meta Wav2Vec2-XLSR (300M parameters).
115
+
116
+ ## Model Details
117
+ We evaluated the model on multiple Persian ASR benchmarks, including Common Voice, and fleurs. Results show that our model outperforms popular models like vosk, fast-conformer and openai's whisper on these benchmarks:
118
+ <p align="center" style="display: flex; justify-content: space-around;">
119
+ <img src="assets/base_common-voice.png" alt="Model Image 1" width="45%" />
120
+ <img src="assets/base_fleurs.png" alt="Model Image 2" width="45%" />
121
+ </p>
122
+
123
+ ## Usage
124
+
125
+ Whisper base is supported in Hugging Face 🤗 Transformers. To run the model, first install the Transformers
126
+ library.
127
+
128
+ ```bash
129
+ pip install --upgrade pip
130
+ pip install --upgrade transformers
131
+ ```
132
+
133
+ The model can be used with the [`pipeline`](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline)
134
+ class to transcribe audios of arbitrary length:
135
+
136
+ ```python
137
+ import torch
138
+ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
139
+
140
+
141
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
142
+ torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
143
+
144
+ model_id = "C1Tech/whisper_base_persian"
145
+
146
+ model = AutoModelForSpeechSeq2Seq.from_pretrained(
147
+ model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
148
+ )
149
+ model.to(device)
150
+
151
+ processor = AutoProcessor.from_pretrained(model_id)
152
+
153
+ pipe = pipeline(
154
+ "automatic-speech-recognition",
155
+ model=model,
156
+ tokenizer=processor.tokenizer,
157
+ feature_extractor=processor.feature_extractor,
158
+ torch_dtype=torch_dtype,
159
+ device=device,
160
+ )
161
+
162
+ ```
163
+
164
+ To transcribe a local audio file, simply pass the path to your audio file when you call the pipeline:
165
+
166
+ ```python
167
+ result = pipe("audio.mp3")
168
+ ```
169
+
170
+ Multiple audio files can be transcribed in parallel by specifying them as a list and setting the `batch_size` parameter:
171
+
172
+ ```python
173
+ result = pipe(["audio_1.mp3", "audio_2.mp3"], batch_size=2)
174
+ ```
175
+
176
+ Transformers is compatible with all Whisper decoding strategies, such as temperature fallback and condition on previous
177
+ tokens. The following example demonstrates how to enable these heuristics:
178
+
179
+ ```python
180
+ generate_kwargs = {
181
+ "num_beams": 3,
182
+ "condition_on_prev_tokens": False,
183
+ "compression_ratio_threshold": 1.35, # zlib compression ratio threshold (in token space)
184
+ "temperature": (0.0, 0.2, 0.4, 0.6, 0.8, 1.0),
185
+ "logprob_threshold": -1.0,
186
+ "no_speech_threshold": 0.6,
187
+ "return_timestamps": True,
188
+ "language": "fa"
189
+ }
190
+
191
+ result = pipe(sample, generate_kwargs=generate_kwargs)
192
+ ```
193
+
194
+ Finally, the model can be made to predict timestamps. For sentence-level timestamps, pass the `return_timestamps` argument:
195
+
196
+ ```python
197
+ result = pipe(sample, return_timestamps=True)
198
+ print(result["chunks"])
199
+ ```
200
+
201
+ And for word-level timestamps:
202
+
203
+ ```python
204
+ result = pipe(sample, return_timestamps="word")
205
+ print(result["chunks"])
206
+ ```
assets/base_common-voice.png ADDED

Git LFS Details

  • SHA256: 2f74a0cad9b8a2c0b416a5f5a2dce4731abedcc973aed1fb76de2777f2a384a8
  • Pointer size: 131 Bytes
  • Size of remote file: 104 kB
assets/base_fleurs.png ADDED