đ Test Wav2Vec2 with Egyptian Arabic
This project fine - tunes the facebook/wav2vec2-large-xlsr-53 model in Egyptian Arabic using the arabicspeech.org MGB-3. It provides a solution for automatic speech recognition in Egyptian Arabic.
đ Quick Start
When using this model, make sure that your speech input is sampled at 16kHz.
⨠Features
- Fine - tuned on Egyptian Arabic using the arabicspeech.org MGB-3 dataset.
- Can be used directly without a language model.
đĻ Installation
No specific installation steps are provided in the original document, so this section is skipped.
đģ Usage Examples
Basic Usage
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
dataset = load_dataset("arabic_speech_corpus", split="test")
processor = Wav2Vec2Processor.from_pretrained("othrif/wav2vec_test")
model = Wav2Vec2ForCTC.from_pretrained("othrif/wav2vec_test")
resampler = torchaudio.transforms.Resample(48_000, 16_000)
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = torchaudio.load(batch["path"])
batch["speech"] = resampler(speech_array).squeeze().numpy()
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
predicted_ids = torch.argmax(logits, dim=-1)
print("Prediction:", processor.batch_decode(predicted_ids))
print("Reference:", test_dataset["sentence"][:2])
đ Documentation
Model Information
Property |
Details |
Model Name |
XLSR Wav2Vec2 Egyptian by Zaid Alyafeai and Othmane Rifki |
Model Type |
Fine - tuned Wav2Vec2 model for Egyptian Arabic speech recognition |
Training Data |
arabicspeech.org MGB-3 |
Datasets |
https://arabicspeech.org/ |
Tags |
audio, automatic - speech - recognition, speech |
License |
apache - 2.0 |
Results
The model has the following performance on the arabicspeech.org MGB-3 dataset:
Task |
Dataset |
Metric |
Value |
Speech Recognition (automatic - speech - recognition) |
arabicspeech.org MGB-3 (ar) |
Test WER (wer) |
55.2 |
đ§ Technical Details
No technical details are provided in the original document, so this section is skipped.
đ License
This project is licensed under the Apache 2.0 license.