--- license: cc-by-nc-4.0 language: - ar tags: - automatic-speech-recognition - whisper - arabic - bahraini library_name: transformers pipeline_tag: automatic-speech-recognition --- # Bahraini ASR (Whisper Fine-tune) Bahraini Arabic ASR fine-tune based on `MohamedRashad/Arabic-Whisper-CodeSwitching-Edition`. ## Public model package - `bahraini_asr_codeswitching` - this public package is the Bahraini ASR release bundle kept under a stable name instead of a raw checkpoint folder - tokenizer config was normalized for direct `WhisperProcessor.from_pretrained(...)` loading - interactive listening page: [`Hishambarakat/Bahraini_ASR_Review`](https://huggingface.co/spaces/Hishambarakat/Bahraini_ASR_Review) ## Inference Install the Python dependencies listed in [`requirements.txt`](requirements.txt) first: ```bash pip install -r requirements.txt ``` ```python import torch from transformers import WhisperForConditionalGeneration, WhisperProcessor, pipeline model_id = "Hishambarakat/Bahraini_ASR" subfolder = "bahraini_asr_codeswitching" processor = WhisperProcessor.from_pretrained(model_id, subfolder=subfolder) model = WhisperForConditionalGeneration.from_pretrained(model_id, subfolder=subfolder) pipe = pipeline( "automatic-speech-recognition", model=model, tokenizer=processor.tokenizer, feature_extractor=processor.feature_extractor, device=0 if torch.cuda.is_available() else -1, ) result = pipe("/path/to/audio.wav", generate_kwargs={"language": "ar", "task": "transcribe"}) print(result["text"]) ``` ## What was trained - Base model: `MohamedRashad/Arabic-Whisper-CodeSwitching-Edition` - Baseline pretraining data included `MohamedRashad/arabic-english-code-switching` - Private Bahraini speech corpus with manual transcript cleanup - Dialect-specific correction passes for Bahraini phrasing - Review-driven checkpoint selection from unseen clips - The public release is packaged under `bahraini_asr_codeswitching` ## Why Bahraini fine-tuning matters The baseline model is useful, but its upstream code-switching data includes a broader Arabic mix and is not specialized for Bahraini dialect preservation. In practice, that means some outputs can be semantically plausible while still drifting away from the speaker's local wording. This matters for Bahraini ASR because a transcript can look "close enough" in standard Arabic or another dialect while still failing to preserve the actual form that was spoken. ![Bahraini ASR overview](assets/Bahraini_ASR.png) ## Evaluation summary This checkpoint was selected from a manual unseen-clip review rather than a formal WER/CER benchmark. On the original `50`-clip `checkpoint-1250` review sheet: - `ours`: `22` - `tie`: `20` - `baseline`: `4` - `both_bad`: `4` Raw counts from that sheet suggest a strong advantage for the fine-tuned model, but for public-facing reporting we should be more conservative than the raw sheet alone: - a reasonable conservative takeaway is that the fine-tuned model was better on at least roughly `60%+` of meaningful cases - it was at minimum competitive with the baseline on a clear majority of the reviewed clips - exact percentages should be treated as approximate because some rows were later re-checked manually and a few public-facing examples were judged more cautiously This original review result is the main reason `checkpoint-1250` was chosen as the public release over later checkpoints. Important note: - these counts come from the original `checkpoint-1250` review CSV - the local example table below was re-vetted manually afterward - some later local proxy review files had labeling inconsistencies, so the example table is treated as the more conservative public-facing evidence set - in other words: the counts below are from the original 1250 review pass, while the example rows were hand-pruned to avoid overstating wins ## Dialect preservation candidates In addition to the manual 50-clip review, we ran a separate text-only mining pass over the private training corpus to look for likely dialect-preservation patterns between: - `text` - `text_asr_v5_raw` This is not a benchmark and should not be read as ASR accuracy. It is a heuristic analysis meant to surface likely cases where a local Bahraini form was shifted toward a more common outside-dialect form. Topline from that pass: - total train rows scanned: `52,695` - changed transcript rows (`text != text_asr_v5_raw`): `50,335` - heuristic dialect-shift candidates: `360` - strict local-to-common substitution cases: `37` Conservative interpretation: - heuristic dialect-shift candidates account for about `0.72%` of changed rows - the stricter local-to-common subset accounts for about `0.07%` of changed rows - these are small percentages in absolute terms, but they are high-value because they target the exact dialect-preservation failure mode we care about Most common strict patterns found: - `ليش -> ليه`: `19` - `مب -> مش`: `18` Useful framing: - some baseline outputs are semantically plausible, but they do not preserve the speaker's original dialect wording - this analysis is best treated as **dialect preservation candidate mining**, not formal detection accuracy ## Review examples These clips are the strongest remaining `ours` wins from the corrected local review file after removing rows that we manually judged as baseline, tie, or both_bad. Hugging Face model cards do not show a built-in inline playbar for these samples here. Click a `.wav` link below and Hugging Face/browser will open the file in its audio player. | Sample | Ours (`checkpoint-1250`) | Baseline | Vote | | --- | --- | --- | --- | | [sample_01.wav](review_evidence/audio/sample_01.wav) | علشان احنا نسوي هذا النزول او نهدف لهذا النوع من النزول | علشان نهدف لهذا النزول مهم | ours | | [sample_02.wav](review_evidence/audio/sample_02.wav) | ننتقل من الشق البصري إلى الشق الكتابي لأن الكتابة هي نوع من نوع الخيال بعد | ننتقل من الشق البصري إلى الشق الكتابي لأن الكتاب هي نوع من نوع الخيال بعد | ours | | [sample_03.wav](review_evidence/audio/sample_03.wav) | شنو يعني من قصص تعرفينها في هذه الصدد؟ | من قصص تعرفينها في هذه الصدد؟ | ours | | [sample_04.wav](review_evidence/audio/sample_04.wav) | القيام اتواضحلي اشلون انا ابي اوصل حق هاي الأهداف | القيام توضح لي أشلون وأنا بيوصل حق هذه الأهداف | ours | | [sample_05.wav](review_evidence/audio/sample_05.wav) | قائما يعني نزل حق منازل هذه الناس وخلّك يعني أدن منهم | طايماً يعني انزل حجم نازل هذه الناس و خلك يعني أدنى منهم | ours | | [sample_06.wav](review_evidence/audio/sample_06.wav) | يعني فيديو سحبك على فيديو سحبك على الثاني موعت الأطالق ساعة ثنتين | يعني فيديو سحبك على فيديو سحبك على ثاني ماوعيتك لتطلع الساعة اثنتين | ours | | [sample_07.wav](review_evidence/audio/sample_07.wav) | فدائما هنا جولات الأكل هي اللي تربطك | ف دائما هنا جولات الأكل هي اللي تربطك | ours | ## Notes - This repo is model-only. - The training dataset is private and published separately. - These examples are kept conservative to avoid showing rows that we manually disagree with. - The sample links above open the WAV files directly from the Hub rather than embedding a playbar inside the model card.