Downloads · 30 days
2
2% of all-time downloads
amzilmustapha/cohere-darija-lora-10-7-26
cohere-darija-lora-10-7-26 is a automatic speech recognition model from amzilmustapha. Use it when you need speech turned into text. It is set up for peft.
This model is a fine-tuned LoRA adapter for the CohereLabs/cohere-transcribe-arabic-07-2026 Automatic Speech Recognition (ASR) model. It has been specifically trained to improve transcription accuracy for Moroccan Dar…
Downloads · 30 days
2
2% of all-time downloads
All-time downloads
108
Public
Repo size
132 MB
Likes
0
Public
Click a slice to open those files.
.safetensors132 MB · 100%
From the Hugging Face model README
This model is a fine-tuned LoRA adapter for the CohereLabs/cohere-transcribe-arabic-07-2026 Automatic Speech Recognition (ASR) model. It has been specifically trained to improve transcription accuracy for Moroccan Darija.
The model was fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with LoRA and 8-bit quantization.
You can use this adapter by loading the base model and merging it with this LoRA repository.
import librosa
import torch
from transformers import AutoFeatureExtractor, AutoTokenizer, CohereAsrForConditionalGeneration
from peft import PeftModel
base_model_id = "CohereLabs/cohere-transcribe-arabic-07-2026"
adapter_repo = "amzilmustapha/cohere-darija-lora-10-7-26"
hf_token = "YOUR_HF_TOKEN" # Required for the gated base model
# Load processors
feature_extractor = AutoFeatureExtractor.from_pretrained(base_model_id, trust_remote_code=True, token=hf_token)
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True, token=hf_token)
# Load base model
base_model = CohereAsrForConditionalGeneration.from_pretrained(
base_model_id,
device_map="auto",
trust_remote_code=True,
token=hf_token
)
# Apply LoRA Adapter
model = PeftModel.from_pretrained(base_model, adapter_repo, token=hf_token)
# Process Audio
audio_file = "your_darija_audio.wav"
audio_array, sampling_rate = librosa.load(audio_file, sr=16000)
inputs = feature_extractor(audio_array, sampling_rate=16000, return_tensors="pt")
input_features = inputs.input_features.to(model.device)
# Generate Transcription
with torch.no_grad():
generated_ids = model.generate(inputs=input_features, max_new_tokens=100)
transcription = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(transcription)