AbrFerdowsi's picture
Upload folder using huggingface_hub (part 3)
6a125ea verified
|
Raw History Blame Contribute Delete
4.13 kB

Sequential Fine-Tuning of Whisper for Persian ASR

1. Overview

This document describes a sequential fine-tuning strategy for adapting the OpenAI Whisper model to large-scale Persian (Farsi) Automatic Speech Recognition (ASR) datasets. The approach is designed for scenarios where multiple very large datasets (β‰ˆ244 GB each) are available and training must be done in stages rather than as a single joint run.

The goal is to incrementally improve ASR performance while maintaining stability, avoiding catastrophic forgetting, and ensuring reproducibility.


2. Problem Statement

  • Number of datasets: 7
  • Language: Persian (Farsi)
  • Sampling rate: 16 kHz (native Whisper format)
  • Task: Speech-to-text (transcription only)
  • Dataset size: ~244 - ~300 GB per dataset

Due to data volume and compute constraints, training on all datasets simultaneously is impractical. Therefore, sequential fine-tuning is used.


3. Proposed Training Strategy

3.1 Sequential Fine-Tuning

The model is trained iteratively:

  1. Start from the base Whisper model
  2. Fine-tune on Dataset 1 β†’ save best checkpoint
  3. Load best checkpoint from Dataset 1
  4. Fine-tune on Dataset 2 β†’ save best checkpoint
  5. Repeat until Dataset 7

The final model is the best checkpoint obtained from the last dataset.

This strategy allows gradual adaptation while preserving previously learned knowledge.


4. Risk Analysis

4.1 Catastrophic Forgetting

Catastrophic forgetting occurs when a model loses performance on earlier datasets after training on new data.

Risk level in this project: LOW, because:

  • All datasets are Persian
  • Same task (ASR)
  • Same sampling rate (16 kHz)
  • Same tokenizer and vocabulary

However, mitigation strategies are still applied as best practice.


5. Learning Rate Policy

5.1 Motivation

Later datasets should refine the model rather than overwrite earlier representations. Therefore, learning rate must decrease over time.

5.2 Recommended Learning Rate Schedule

Dataset Learning Rate
DS1 1e-5
DS2 5e-6
DS3 5e-6
DS4 2e-6
DS5 2e-6
DS6 1e-6
DS7 1e-6

This gradual decay ensures stable convergence and reduces forgetting.

6. Checkpointing Strategy

6.1 Intra-Dataset Checkpointing

During training on each dataset:

  • Save checkpoints every 1000 steps
  • Evaluate every 1000 steps
  • Track Word Error Rate (WER)
  • Load best checkpoint at end of training

6.2 Inter-Dataset Checkpointing

Each dataset has its own output directory:

Checkpoints/
 β”œβ”€β”€ ds1/
 β”‚    └── best/
 β”œβ”€β”€ ds2/
 β”‚    └── best/
 β”œβ”€β”€ ds3/
 β”‚    └── best/
 β”œβ”€β”€ ds4/
 β”‚    └── best/
 β”œβ”€β”€ ds5/
 β”‚    └── best/
 β”œβ”€β”€ ds6/
 β”‚    └── best/
 └── ds7/
      └── best/   ← Final Model

This structure allows rollback, debugging, and domain-specific model reuse.


7. Evaluation Protocol

7.1 Metrics

  • Primary metric: Word Error Rate (WER)
  • Evaluation performed at fixed step intervals

7.2 Validation Sets

  • Maintain a small validation split per dataset
  • Optionally evaluate previous datasets to detect regression

8. Logging and Monitoring

8.1 TensorBoard

Training and evaluation metrics are logged using TensorBoard:

  • Training loss
  • Evaluation loss
  • Evaluation WER
  • Learning rate

TensorBoard enables comparison across datasets and early detection of instability.


9. Whisper-Specific Configuration

  • Language token forced to Persian (<|fa|>)
  • Task set to transcription only
  • No translation mixing
  • Consistent text normalization (digits, punctuation)

10. Trainer Configuration Example

Key parameters:

  • Gradient accumulation for large effective batch size
  • BF16 precision for performance
  • Checkpoint saving every 1000 steps
  • Best model selection based on WER

This configuration balances performance, stability, and resource efficiency.