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...
Fuente del modelo
Descripción de la fuente
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.
Fuentes
1 fuenteVerificado 14 sept
Artefactos del modelo
1 artefactoExtractos de fuentes
2 extractosThe 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)
--- language: - ar tags: - automatic-speech-recognition - speech-to-text - darija - moroccan-arabic - peft - lora base_model: CohereLabs/cohere-transcribe-arabic-07-2026 datasets: - atlasia/DODa-audio-dataset --- # Cohere ASR - Moroccan Darija (LoRA Adapter) 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**. ## Model Details - **Base Model:** [CohereLabs/cohere-transcribe-arabic-07-2026](https://huggingface.co/CohereLabs/cohere-transcribe-arabic-07-2026) - **Dataset:** Fine-tuned on the [atlasia/DODa-audio-dataset](https://huggingface.co/datasets/atlasia/DODa-audio-dataset) (Moroccan Darija audio samples). - **Task:** Speech-to-Text / Automatic Speech Recognition (ASR) - **Language:** Moroccan Arabic (Darija) ## Training Configuration The model was fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with LoRA and 8-bit quantization. - **Steps:** 500 - **Batch Size:** 4 (with Gradient Accumulation Steps = 4) - **Learning Rate:** 1e-4 - **Precision:** 32-bit (fp16 disabled to prevent NaN loss in the audio architecture) ## How to Use You can use this adapter by loading the base model and merging it with this LoRA repository. ```python 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_featur...
Source context: 4 downloads · 0 likes · Pipeline automatic-speech-recognition · Library peft · Repo amzilmustapha/cohere-darija-lora-10-7-26