eemberda commited on
Commit
fa7f84e
·
verified ·
1 Parent(s): 9540ff1

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +107 -1
README.md CHANGED
@@ -2,6 +2,8 @@
2
  license: cc-by-nc-4.0
3
  language:
4
  - tl
 
 
5
  base_model:
6
  - openai/whisper-small
7
  pipeline_tag: automatic-speech-recognition
@@ -12,4 +14,108 @@ tags:
12
  - cebuano-asr
13
  - bisaya
14
  - bisaya-asr
15
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: cc-by-nc-4.0
3
  language:
4
  - tl
5
+ - ceb
6
+ - en
7
  base_model:
8
  - openai/whisper-small
9
  pipeline_tag: automatic-speech-recognition
 
14
  - cebuano-asr
15
  - bisaya
16
  - bisaya-asr
17
+ - code-switching
18
+ ---
19
+
20
+ # phcodeswitch-ceb-dvo
21
+
22
+ Whisper `small` fine-tuned for automatic speech recognition (ASR) of **Davao Cebuano**, including English–Cebuano code-switching.
23
+
24
+ - **Base model:** [openai/whisper-small](https://huggingface.co/openai/whisper-small)
25
+ - **Fine-tuned language:** Cebuano (`ceb`), BCP-47 `ceb`
26
+ - **Task:** Automatic speech recognition (`transcribe`)
27
+ - **Best WER:** 20.86% (test split, step 1200)
28
+ - **License:** CC BY-NC 4.0 — non-commercial research / educational use only
29
+
30
+ ## How to use
31
+
32
+ Install dependencies:
33
+
34
+ ```bash
35
+ pip install --upgrade transformers torch librosa
36
+ ```
37
+
38
+ ### Option 1 – `pipeline` (quickstart)
39
+
40
+ ```python
41
+ from transformers import pipeline
42
+ import librosa
43
+
44
+ pipe = pipeline(
45
+ "automatic-speech-recognition",
46
+ model="eemberda/phcodeswitch-ceb-dvo",
47
+ device=0, # use -1 for CPU
48
+ )
49
+
50
+ audio, sr = librosa.load("sample.wav", sr=16_000, mono=True)
51
+ result = pipe(
52
+ audio,
53
+ generate_kwargs={
54
+ "language": "tl", # Cebuano is not native to Whisper; Tagalog prompt works best
55
+ "task": "transcribe",
56
+ "num_beams": 5,
57
+ },
58
+ )
59
+ print(result["text"])
60
+ ```
61
+
62
+ ### Option 2 – manual inference with processor + model
63
+
64
+ ```python
65
+ from transformers import WhisperForConditionalGeneration, WhisperProcessor
66
+ import librosa
67
+ import torch
68
+
69
+ model_id = "eemberda/phcodeswitch-ceb-dvo"
70
+
71
+ processor = WhisperProcessor.from_pretrained(model_id)
72
+ model = WhisperForConditionalGeneration.from_pretrained(model_id)
73
+ device = "cuda" if torch.cuda.is_available() else "cpu"
74
+ model.to(device).eval()
75
+
76
+ audio, sr = librosa.load("sample.wav", sr=16_000, mono=True)
77
+ inputs = processor.feature_extractor(
78
+ audio, sampling_rate=16_000, return_tensors="pt"
79
+ ).input_features.to(device)
80
+
81
+ forced_decoder_ids = processor.get_decoder_prompt_ids(
82
+ language="tl", task="transcribe"
83
+ )
84
+
85
+ with torch.no_grad():
86
+ predicted_ids = model.generate(
87
+ inputs,
88
+ forced_decoder_ids=forced_decoder_ids,
89
+ num_beams=5,
90
+ )
91
+
92
+ transcription = processor.batch_decode(
93
+ predicted_ids, skip_special_tokens=True
94
+ )[0].strip()
95
+ print(transcription)
96
+ ```
97
+
98
+ ## Language notes
99
+
100
+ - Whisper has **no native Cebuano language token**. The model is fine-tuned on
101
+ Cebuano audio but uses the **Tagalog (`tl`)** decoder prompt, which Whisper
102
+ treats as the closest supported related language.
103
+ - The model also handles English and English–Cebuano code-switched speech.
104
+ - Audio is expected at **16 kHz mono** (resampled automatically by `librosa`
105
+ in the examples above).
106
+
107
+ ## Training details
108
+
109
+ - Base model: `openai/whisper-small`
110
+ - Optimizer: AdamW, learning rate `1e-5`, warmup 100 steps
111
+ - Batch size 4 with gradient accumulation 4 (effective batch 16)
112
+ - Max steps 1800 (best checkpoint at step 1200), early stopping patience 3
113
+ - Mixed precision (fp16), gradient checkpointing, beam search (5) decoding
114
+
115
+ ## Limitations
116
+
117
+ - Trained on a small, community-contributed dataset; coverage of accents and
118
+ vocabulary is limited.
119
+ - For non-commercial research and educational use only (CC BY-NC 4.0).
120
+ - Contributed speaker data must not be used for voice cloning, impersonation,
121
+ or voice synthesis. See the project repository's compliance documents.