File size: 8,427 Bytes
9f80eba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
---
language: ca
datasets:
  - projecte-aina/whisper-large-v3-ca-3catparla
tags:
  - audio
  - automatic-speech-recognition
  - catalan
  - whisper-large-v3
  - projecte-aina
  - barcelona-supercomputing-center
  - bsc
license: apache-2.0
model-index:
  - name: whisper-large-v3-ca-3catparla
    results:
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: 3CatParla (Test)
          type: projecte-aina/3catparla_asr
          split: test
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 0.96
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: 3CatParla (Dev)
          type: projecte-aina/3catparla_asr
          split: dev
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 0.92
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Mozilla Common Voice 17.0 (Test)
          type: mozilla-foundation/common_voice_17_0
          split: test
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 10.32
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Mozilla Common Voice 17.0 (Dev)
          type: mozilla-foundation/common_voice_17_0
          split: validation
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 9.26
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Balearic female
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 12.25
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Balearic male
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 12.18
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Central female
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 8.51
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Central male
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 8.73
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Northern female
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 8.09
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Northern male
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 8.28
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Northwestern female
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 7.88
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Northwestern male
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 8.44
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Valencian female
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 9.58
      - task:
          name: Automatic Speech Recognition
          type: automatic-speech-recognition
        dataset:
          name: Common Voice Benchmark Catalan Accents
          type: projecte-aina/commonvoice_benchmark_catalan_accents
          split: Valencian male
          args:
            language: ca
        metrics:
          - name: WER
            type: wer
            value: 9.10    
---
# whisper-large-v3-ca-3catparla
**Paper:** [3CatParla: A New Open-Source Corpus of Broadcast TV in Catalan for Automatic Speech Recognition](https://iberspeech.tech/)

The "whisper-large-v3-ca-3catparla" is an acoustic model suitable for Automatic Speech Recognition in Catalan. It is the result of fine-tuning the model "openai/whisper-large-v3" with 710 hours of Catalan data released by the Projecte AINA (https://projecteaina.cat/) from Barcelona, Spain.

The specific dataset used to create the model is called ["3Catparla"](projecte-aina/whisper-large-v3-ca-3catparla).

The fine-tuning process was perform during July (2024) in the servers of the [Barcelona Supercomputing Center](https://www.bsc.es/) by [Carlos Daniel Hernández Mena](https://huggingface.co/carlosdanielhernandezmena).

# Evaluation
```python
import torch
from transformers import WhisperForConditionalGeneration, WhisperProcessor

#Load the processor and model.
MODEL_NAME="projecte-aina/whisper-large-v3-ca-3catparla"
processor = WhisperProcessor.from_pretrained(MODEL_NAME)
model = WhisperForConditionalGeneration.from_pretrained(MODEL_NAME).to("cuda")

#Load the dataset
from datasets import load_dataset, load_metric, Audio
ds=load_dataset("projecte-aina/whisper-large-v3-ca-3catparla",split='test')

#Downsample to 16kHz
ds = ds.cast_column("audio", Audio(sampling_rate=16_000))

#Process the dataset
def map_to_pred(batch):
	audio = batch["audio"]
	input_features = processor(audio["array"], sampling_rate=audio["sampling_rate"], return_tensors="pt").input_features
	batch["reference"] = processor.tokenizer._normalize(batch['normalized_text'])

	with torch.no_grad():
		predicted_ids = model.generate(input_features.to("cuda"))[0]
	
	transcription = processor.decode(predicted_ids)
	batch["prediction"] = processor.tokenizer._normalize(transcription)
	
	return batch
	
#Do the evaluation
result = ds.map(map_to_pred)

#Compute the overall WER now.
from evaluate import load

wer = load("wer")
WER=100 * wer.compute(references=result["reference"], predictions=result["prediction"])
print(WER)
```
**Test Result**: 0.96

# BibTeX entry and citation info
* When publishing results based on these models please refer to:
```bibtex
@misc{mena2024whisperlarge3catparla,
      title={Acoustic Model in Catalan: whisper-large-v3-ca-3catparla.}, 
      author={Hernandez Mena, Carlos Daniel},
      organization={Barcelona Supercomputing Center},
      url={https://huggingface.co/projecte-aina/whisper-large-v3-ca-3catparla},
      year={2024}
}
```
# Acknowledgements

This model has been promoted and financed by the Government of Catalonia through the Aina project.