Update README.md
Browse files
README.md
CHANGED
|
@@ -1,206 +1,223 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
base_model: openai/whisper-tiny
|
| 3 |
-
library_name: peft
|
| 4 |
tags:
|
| 5 |
-
-
|
|
|
|
|
|
|
|
|
|
| 6 |
- lora
|
| 7 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 13 |
-
|
| 14 |
|
|
|
|
| 15 |
|
| 16 |
## Model Details
|
| 17 |
|
| 18 |
### Model Description
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
-
- **
|
| 25 |
-
- **
|
| 26 |
-
- **
|
| 27 |
-
- **
|
| 28 |
-
- **
|
| 29 |
-
- **
|
| 30 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 31 |
|
| 32 |
-
### Model Sources
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
- **Repository:** [More Information Needed]
|
| 37 |
-
- **Paper [optional]:** [More Information Needed]
|
| 38 |
-
- **Demo [optional]:** [More Information Needed]
|
| 39 |
|
| 40 |
## Uses
|
| 41 |
|
| 42 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 43 |
-
|
| 44 |
### Direct Use
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
[More Information Needed]
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
[More Information Needed]
|
| 55 |
|
| 56 |
### Out-of-Scope Use
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
[More Information Needed]
|
| 61 |
-
|
| 62 |
-
## Bias, Risks, and Limitations
|
| 63 |
-
|
| 64 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 65 |
-
|
| 66 |
-
[More Information Needed]
|
| 67 |
-
|
| 68 |
-
### Recommendations
|
| 69 |
-
|
| 70 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 71 |
-
|
| 72 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 73 |
|
| 74 |
## How to Get Started with the Model
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
## Training Details
|
| 81 |
|
| 82 |
### Training Data
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
|
| 88 |
### Training Procedure
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
#### Preprocessing [optional]
|
| 93 |
-
|
| 94 |
-
[More Information Needed]
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
#### Training Hyperparameters
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
## Evaluation
|
| 108 |
-
|
| 109 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 110 |
|
| 111 |
-
###
|
| 112 |
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
##
|
| 120 |
-
|
| 121 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 122 |
|
| 123 |
-
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
### Results
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
[More Information Needed]
|
| 144 |
-
|
| 145 |
-
## Environmental Impact
|
| 146 |
-
|
| 147 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 148 |
-
|
| 149 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 150 |
-
|
| 151 |
-
- **Hardware Type:** [More Information Needed]
|
| 152 |
-
- **Hours used:** [More Information Needed]
|
| 153 |
-
- **Cloud Provider:** [More Information Needed]
|
| 154 |
-
- **Compute Region:** [More Information Needed]
|
| 155 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 156 |
-
|
| 157 |
-
## Technical Specifications [optional]
|
| 158 |
-
|
| 159 |
-
### Model Architecture and Objective
|
| 160 |
|
| 161 |
-
|
| 162 |
|
| 163 |
-
##
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Hardware
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
#### Software
|
| 172 |
-
|
| 173 |
-
[More Information Needed]
|
| 174 |
-
|
| 175 |
-
## Citation [optional]
|
| 176 |
-
|
| 177 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 178 |
-
|
| 179 |
-
**BibTeX:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
**APA:**
|
| 184 |
-
|
| 185 |
-
[More Information Needed]
|
| 186 |
-
|
| 187 |
-
## Glossary [optional]
|
| 188 |
|
| 189 |
-
|
|
|
|
|
|
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
|
| 201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
-
|
| 204 |
-
### Framework versions
|
| 205 |
|
| 206 |
-
- PEFT 0.18.1
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- ja
|
| 4 |
+
license: apache-2.0
|
| 5 |
base_model: openai/whisper-tiny
|
|
|
|
| 6 |
tags:
|
| 7 |
+
- whisper
|
| 8 |
+
- japanese
|
| 9 |
+
- asr
|
| 10 |
+
- speech-recognition
|
| 11 |
- lora
|
| 12 |
+
- peft
|
| 13 |
+
- fine-tuned
|
| 14 |
+
library_name: transformers
|
| 15 |
+
metrics:
|
| 16 |
+
- cer
|
| 17 |
+
pipeline_tag: automatic-speech-recognition
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# whisper-tiny-ja-lora
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
A LoRA-finetuned version of [openai/whisper-tiny](https://huggingface.co/openai/whisper-tiny) for **Japanese Automatic Speech Recognition (ASR)**, trained on the [ReazonSpeech](https://huggingface.co/datasets/reazon-research/reazonspeech) dataset using Parameter-Efficient Fine-Tuning (PEFT/LoRA).
|
| 23 |
|
| 24 |
## Model Details
|
| 25 |
|
| 26 |
### Model Description
|
| 27 |
|
| 28 |
+
This model applies Low-Rank Adaptation (LoRA) on top of Whisper Tiny to improve Japanese transcription quality while keeping the number of trainable parameters small. LoRA adapters are merged post-training for easy deployment.
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
- **Model type:** Automatic Speech Recognition (ASR)
|
| 31 |
+
- **Language:** Japanese (ja)
|
| 32 |
+
- **Base model:** [openai/whisper-tiny](https://huggingface.co/openai/whisper-tiny)
|
| 33 |
+
- **Fine-tuning method:** LoRA (Low-Rank Adaptation) via PEFT
|
| 34 |
+
- **License:** Apache 2.0
|
| 35 |
+
- **Developed by:** [dungca](https://huggingface.co/dungca)
|
|
|
|
| 36 |
|
| 37 |
+
### Model Sources
|
| 38 |
|
| 39 |
+
- **Training repository:** [dungca1512/whisper-finetune-ja-train](https://github.com/dungca1512/whisper-finetune-ja-train)
|
| 40 |
+
- **Base model:** [openai/whisper-tiny](https://huggingface.co/openai/whisper-tiny)
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
## Uses
|
| 43 |
|
|
|
|
|
|
|
| 44 |
### Direct Use
|
| 45 |
|
| 46 |
+
This model is designed for Japanese speech-to-text transcription tasks:
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
- Transcribing Japanese audio files
|
| 49 |
+
- Japanese voice assistants and conversational AI
|
| 50 |
+
- Japanese language learning applications (e.g., pronunciation feedback)
|
| 51 |
+
- Subtitle generation for Japanese audio/video content
|
|
|
|
| 52 |
|
| 53 |
### Out-of-Scope Use
|
| 54 |
|
| 55 |
+
- Non-Japanese speech (model is fine-tuned specifically for Japanese)
|
| 56 |
+
- Real-time streaming ASR in latency-critical production systems (whisper-tiny architecture may not meet accuracy requirements)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
## How to Get Started with the Model
|
| 59 |
|
| 60 |
+
### Load LoRA Adapter (PEFT)
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
import torch
|
| 64 |
+
from transformers import AutoProcessor, WhisperForConditionalGeneration
|
| 65 |
+
from peft import PeftModel
|
| 66 |
+
|
| 67 |
+
# Load base model and processor
|
| 68 |
+
base_model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny")
|
| 69 |
+
processor = AutoProcessor.from_pretrained("openai/whisper-tiny")
|
| 70 |
+
|
| 71 |
+
# Load LoRA adapter
|
| 72 |
+
model = PeftModel.from_pretrained(base_model, "dungca/whisper-tiny-ja-lora")
|
| 73 |
+
model.eval()
|
| 74 |
+
|
| 75 |
+
# Transcribe audio
|
| 76 |
+
def transcribe(audio_array, sampling_rate=16000):
|
| 77 |
+
inputs = processor(
|
| 78 |
+
audio_array,
|
| 79 |
+
sampling_rate=sampling_rate,
|
| 80 |
+
return_tensors="pt"
|
| 81 |
+
)
|
| 82 |
+
with torch.no_grad():
|
| 83 |
+
predicted_ids = model.generate(
|
| 84 |
+
inputs["input_features"],
|
| 85 |
+
language="japanese",
|
| 86 |
+
task="transcribe"
|
| 87 |
+
)
|
| 88 |
+
return processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### Quick Inference with Pipeline
|
| 92 |
+
|
| 93 |
+
```python
|
| 94 |
+
from transformers import pipeline
|
| 95 |
+
from peft import PeftModel, PeftConfig
|
| 96 |
+
from transformers import WhisperForConditionalGeneration, AutoProcessor
|
| 97 |
+
|
| 98 |
+
config = PeftConfig.from_pretrained("dungca/whisper-tiny-ja-lora")
|
| 99 |
+
base_model = WhisperForConditionalGeneration.from_pretrained(config.base_model_name_or_path)
|
| 100 |
+
model = PeftModel.from_pretrained(base_model, "dungca/whisper-tiny-ja-lora")
|
| 101 |
+
|
| 102 |
+
processor = AutoProcessor.from_pretrained(config.base_model_name_or_path)
|
| 103 |
+
|
| 104 |
+
asr = pipeline(
|
| 105 |
+
"automatic-speech-recognition",
|
| 106 |
+
model=model,
|
| 107 |
+
tokenizer=processor.tokenizer,
|
| 108 |
+
feature_extractor=processor.feature_extractor,
|
| 109 |
+
generate_kwargs={"language": "japanese", "task": "transcribe"},
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
result = asr("your_audio.wav")
|
| 113 |
+
print(result["text"])
|
| 114 |
+
```
|
| 115 |
|
| 116 |
## Training Details
|
| 117 |
|
| 118 |
### Training Data
|
| 119 |
|
| 120 |
+
- **Dataset:** [ReazonSpeech](https://huggingface.co/datasets/reazon-research/reazonspeech) (`small` split)
|
| 121 |
+
- **Language:** Japanese (ja)
|
| 122 |
+
- ReazonSpeech is a large-scale Japanese speech corpus collected from broadcast TV, covering diverse speaking styles and topics.
|
| 123 |
|
| 124 |
### Training Procedure
|
| 125 |
|
| 126 |
+
#### LoRA Configuration
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
+
| Parameter | Value |
|
| 129 |
+
|---|---|
|
| 130 |
+
| `lora_r` | 16 |
|
| 131 |
+
| `lora_alpha` | 32 |
|
| 132 |
+
| `lora_dropout` | 0.05 |
|
| 133 |
+
| `target_modules` | `q_proj`, `v_proj` |
|
| 134 |
|
| 135 |
#### Training Hyperparameters
|
| 136 |
|
| 137 |
+
| Parameter | Value |
|
| 138 |
+
|---|---|
|
| 139 |
+
| Learning rate | `1e-5` |
|
| 140 |
+
| Batch size | 32 |
|
| 141 |
+
| Epochs | ~1.55 (3000 steps) |
|
| 142 |
+
| Training regime | fp16 mixed precision |
|
| 143 |
+
| Optimizer | AdamW |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
+
#### Infrastructure
|
| 146 |
|
| 147 |
+
| | |
|
| 148 |
+
|---|---|
|
| 149 |
+
| **Hardware** | Kaggle GPU — NVIDIA P100 (16GB) |
|
| 150 |
+
| **Cloud Provider** | Kaggle (Google Cloud) |
|
| 151 |
+
| **Compute Region** | US |
|
| 152 |
+
| **Framework** | Transformers + PEFT + Datasets |
|
| 153 |
+
| **PEFT version** | 0.18.1 |
|
| 154 |
|
| 155 |
+
### MLOps Pipeline
|
| 156 |
|
| 157 |
+
Training is fully automated via GitHub Actions:
|
| 158 |
+
- **CI:** Syntax check + lightweight data validation on every push
|
| 159 |
+
- **CT (Continuous Training):** Triggers Kaggle kernel for LoRA fine-tuning on data/code changes
|
| 160 |
+
- **CD:** Quality gate checks CER before promoting model to HuggingFace Hub
|
| 161 |
|
| 162 |
+
## Evaluation
|
|
|
|
|
|
|
| 163 |
|
| 164 |
+
### Testing Data
|
| 165 |
|
| 166 |
+
Evaluated on the ReazonSpeech validation split.
|
| 167 |
|
| 168 |
+
### Metrics
|
| 169 |
|
| 170 |
+
- **CER (Character Error Rate):** Lower is better. Standard metric for Japanese ASR (character-level, unlike WER used for English).
|
| 171 |
|
| 172 |
### Results
|
| 173 |
|
| 174 |
+
| Metric | Value |
|
| 175 |
+
|---|---|
|
| 176 |
+
| **eval/cer** | **0.52497** (~52.5%) |
|
| 177 |
+
| eval/loss | 1.17656 |
|
| 178 |
+
| eval/runtime | 162.422s |
|
| 179 |
+
| eval/samples_per_second | 12.314 |
|
| 180 |
+
| eval/steps_per_second | 0.770 |
|
| 181 |
+
| train/global_step | 3000 |
|
| 182 |
+
| train/epoch | 1.547 |
|
| 183 |
+
| train/grad_norm | 2.161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
+
> **Note:** CER of ~52.5% reflects the constraints of `whisper-tiny` (39M parameters) on a small training subset. A follow-up experiment with `whisper-small` and extended training is in progress and expected to significantly reduce CER.
|
| 186 |
|
| 187 |
+
## Bias, Risks, and Limitations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
+
- **Model size:** Whisper Tiny is optimized for speed and efficiency, not peak accuracy. Expect higher error rates on noisy audio, accented speech, or domain-specific vocabulary.
|
| 190 |
+
- **Training data scope:** Trained on broadcast Japanese; may perform worse on conversational or dialectal Japanese.
|
| 191 |
+
- **CER baseline:** The current CER reflects an early training checkpoint. Further training epochs and a larger model size (`whisper-small`) are expected to improve results.
|
| 192 |
|
| 193 |
+
### Recommendations
|
| 194 |
|
| 195 |
+
For production use cases requiring high accuracy, consider using [openai/whisper-large-v3](https://huggingface.co/openai/whisper-large-v3) or waiting for the upcoming `whisper-small-ja-lora` checkpoint.
|
| 196 |
|
| 197 |
+
## Citation
|
| 198 |
|
| 199 |
+
If you use this model, please cite the base Whisper model and the LoRA/PEFT method:
|
| 200 |
|
| 201 |
+
```bibtex
|
| 202 |
+
@misc{radford2022whisper,
|
| 203 |
+
title={Robust Speech Recognition via Large-Scale Weak Supervision},
|
| 204 |
+
author={Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
|
| 205 |
+
year={2022},
|
| 206 |
+
eprint={2212.04356},
|
| 207 |
+
archivePrefix={arXiv}
|
| 208 |
+
}
|
| 209 |
|
| 210 |
+
@misc{hu2021lora,
|
| 211 |
+
title={LoRA: Low-Rank Adaptation of Large Language Models},
|
| 212 |
+
author={Hu, Edward J. and others},
|
| 213 |
+
year={2021},
|
| 214 |
+
eprint={2106.09685},
|
| 215 |
+
archivePrefix={arXiv}
|
| 216 |
+
}
|
| 217 |
+
```
|
| 218 |
|
| 219 |
+
### Framework Versions
|
|
|
|
| 220 |
|
| 221 |
+
- PEFT: 0.18.1
|
| 222 |
+
- Transformers: ≥4.36.0
|
| 223 |
+
- PyTorch: ≥2.0.0
|