The "whisper-large-v3-tiny-caesar" is an acoustic model based on "openai/whisper-large-v3" suitable for Automatic Speech Recognition in code-switching conditions between Spanish and Catalan.
Model Description
The "whisper-large-v3-tiny-caesar" is an acoustic model suitable for Automatic Speech Recognition in code-switching conditions between Spanish and Catalan. It is the result of fine-tuning the "openai/whisper-large-v3" with CAESAR-TINY, a 2-hour code-switching dataset in Spanish/Catalan.
Intended Uses and Limitations
This model can be used for Automatic Speech Recognition (ASR) in code-switching conditions between Spanish and Catalan. The model is intended to transcribe audio files to plain text.
How to Get Started with the Model
To see an updated and functional version of this code, please check our Notebook
1#This code works with GPU23#Notice that: load_metric is no longer part of datasets.4# You have to remove it and use evaluate's load instead.5#(Note from November 2024)67import torch
8from transformers import WhisperForConditionalGeneration, WhisperProcessor
910#Load the processor and model.11MODEL_NAME="projecte-aina/whisper-large-v3-tiny-caesar"12processor = WhisperProcessor.from_pretrained(MODEL_NAME)13model = WhisperForConditionalGeneration.from_pretrained(MODEL_NAME).to("cuda")1415#Load the dataset16from datasets import load_dataset, load_metric, Audio
17ds=load_dataset("projecte-aina/3catparla_asr",split='test')1819#Downsample to 16kHz20ds = ds.cast_column("audio", Audio(sampling_rate=16_000))2122#Process the dataset23defmap_to_pred(batch):24 audio = batch["audio"]25 input_features = processor(audio["array"], sampling_rate=audio["sampling_rate"], return_tensors="pt").input_features
26 batch["reference"]= processor.tokenizer._normalize(batch['normalized_text'])2728with torch.no_grad():29 predicted_ids = model.generate(input_features.to("cuda"))[0]3031 transcription = processor.decode(predicted_ids)32 batch["prediction"]= processor.tokenizer._normalize(transcription)3334return batch
3536#Do the evaluation37result = ds.map(map_to_pred)3839#Compute the overall WER now.40from evaluate import load
4142wer = load("wer")43WER=100* wer.compute(references=result["reference"], predictions=result["prediction"])44print(WER)
Training Details
Training data
The specific dataset used to create the model is a corpus called CAESAR-tiny, which has not been released at the moment.