Skip to content

Commit c90344d

Browse files
authored
Update README.md
1 parent 6944aee commit c90344d

1 file changed

Lines changed: 34 additions & 26 deletions

File tree

README.md

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,52 @@
11
# Project Plan: Norwegian Voice Fine-tuning for Qwen-Omni
22

3-
The primary goal of this project is to enable **Qwen2.5-Omni-3B** to generate natural Norwegian speech by training the model's "Thinker" component to predict the correct **Mimi** audio tokens.
3+
The primary goal of this project is to enable **Qwen2.5-Omni-3B** to generate natural Norwegian speech.
4+
5+
**Current Focus:** Transitioning from "Raw Audio Training" to **"Instruction Tuning"**. The previous model achieved excellent voice quality but suffered from behavioral issues (mimicking a politician too closely and ignoring user commands). We are now retraining to fix these logic issues while retaining the high-fidelity voice.
46

57
---
68

79
## 📋 Execution Plan
810

9-
### Background & Previous Attempt
10-
* **Initial Training**: We previously conducted a full training run using the **Google FLEURS** dataset.
11-
* **Outcome**: The results were unsatisfactory, with poor audio quality and unnatural speech patterns.
12-
* **The Pivot**: Based on these results, we decided to restart the training using a larger, higher-quality dataset (NPSC) with a focus on better audio fidelity (24kHz) and natural prosody.
11+
### 🔄 Iteration History
12+
* **Attempt 1 (FLEURS):** Resulted in poor audio quality and unnatural speech patterns.
13+
* **Attempt 2 (NPSC Raw):** **Technical Success on Voice.** The model learned perfect Norwegian prosody, dialect, and intonation.
14+
* *Issue Identified:* **"Catastrophic Forgetting" / Domain Overfitting.** The model learned the *style* of the Storting (Parliament) too well. It ignored instructions and instead generated endless, hallucinated political speeches (e.g., starting sentences with "Høre president..."), eventually leading to infinite loops and OOM crashes.
15+
* **Current Attempt (NPSC Instruct):** Retraining using an **Instruction Tuning** approach to restore the model's ability to follow commands (e.g., "Si dette på norsk") while retaining the high-quality voice.
1316

14-
### Phase 1: Data Acquisition & Refinement
15-
* **Primary Source**: Utilizing the **NPSC (National Parliamentary Speech Corpus)** to ensure high-fidelity Norwegian audio data.
16-
* **Processing**: Resampling all audio to 24kHz to meet the requirements of the Mimi encoder.
17-
* **Selection**: Targeting a dataset of approximately 15,000 clips to provide the model with enough variety for high-quality synthesis.
17+
### Phase 1: Data Acquisition & Filtering
18+
* **Source:** **NPSC (National Parliamentary Speech Corpus)**.
19+
* **Refinement:**
20+
* **Filtering:** Removing all clips shorter than **1.5 seconds** to prevent "repetition loops" (the "Pai... Pai..." audio glitch).
21+
* **Instruction Wrapping:** Instead of mapping `Text -> Audio` directly, we now map `User Instruction` -> `Audio`.
22+
* **Format:** `User: "Les opp denne setningen: [Text]"` -> `Assistant: [Audio Tokens]`
1823

19-
### Phase 2: Audio Tokenization (Talker Preparation)
20-
* **Encoding**: Using the Mimi model to convert raw Norwegian waveforms into discrete audio tokens.
21-
* **Dataset Formatting**: Generating `talker_data.jsonl` where the speech is represented as tokens between `<|audio_bos|>` and `<|audio_eos|>` tags.
24+
### Phase 2: Audio Tokenization & Formatting
25+
* **Script:** `prepare_talker_instruct.py`
26+
* **Method:** Generating `talker_data.jsonl` where every audio clip is paired with a unique command prompt (e.g., "Les opp denne setningen:", "Uttal dette på norsk:") to teach the model **obedience**.
2227

23-
### Phase 3: Fine-tuning with LoRA & Quantization
24-
* **Efficiency**: Implementing 8-bit quantization and LoRA (Low-Rank Adaptation) to train the model effectively on available hardware.
25-
* **Architecture**: Utilizing the `QwenOmniWrapper` to manage multimodal inputs and ensure stable checkpoint saving.
28+
### Phase 3: Fine-tuning (The "Lobotomy Fix")
29+
* **Strategy:** Reducing the number of epochs to prevent overfitting on the "political style" of the dataset.
30+
* **Goal:** To balance the high-fidelity voice generation with the logical capability to stop speaking when the sentence is finished (EOS token learning).
2631

27-
### Phase 4: Validation & Testing
28-
* **Inference**: Running `test_speak.py` to generate Norwegian speech from text and verify the quality of the new adapter.
29-
* **Benchmarking**: Comparing the output against the original base model to document improvements.
32+
### Phase 4: Validation & Debugging
33+
* **Inference Strategy:** Using `debug_norsk.py` with strict `max_new_tokens` limits (e.g., 50 tokens) to prevent VRAM crashes during testing.
34+
* **Metrics:** Evaluating both **Voice Quality** (MOS) and **Instruction Adherence** (Does it say exactly what is written, or does it start a debate?).
3035

3136
---
3237

3338
## 🚦 Status Report
3439

35-
### ✅ Completed
36-
* **Infrastructure**: Docker environment is fully configured with `transformers`, `peft`, and `bitsandbytes`.
37-
* **Automation**: The `entrypoint.sh` pipeline is finalized, connecting data processing, tokenization, and training.
38-
* **Data Scripts**: Refined scripts for NPSC data extraction and Mimi tokenization are operational.
39-
* **CI/CD**: GitHub Actions are set up for automated Docker builds.
40+
### ✅ Completed & Verified
41+
* **Infrastructure:** Full pipeline (Docker, PEFT, BitsAndBytes) is stable.
42+
* **Voice Quality:** Verified high-quality Norwegian acoustics from the NPSC dataset (Attempt 2).
43+
* **Diagnosis:** Successfully identified why the model was "babbling" (Lack of EOS token training / Overfitting on long speeches).
44+
* **New Pipeline:** Created `prepare_talker_instruct.py` to handle data filtering (>1.5s) and instruction formatting.
45+
46+
### ⚠️ Known Issues (Being Fixed)
47+
* **"Politician Mode":** The previous model would start sentences with "President..." regardless of the input text.
48+
* **Infinite Loops:** Without instruction tuning, the model often fails to generate an `<|im_end|>` token, leading to "echo" glitches (ASCII garbage) and memory crashes.
4049

4150
### ⏳ Ongoing / Next Steps
42-
* **Full-scale Training**: Currently executing the new training run on the 15,000 NPSC samples.
43-
* **Hyperparameter Tuning**: Monitoring the training loss and adjusting the learning rate for the "Talker-only" phase.
44-
* **Quality Assurance**: Evaluating generated audio samples to ensure the model correctly captures Norwegian phonemes and intonation.
51+
* **Run 3:** Executing the **Instruction Tuned** training run now.
52+
* **Verification:** Testing if the new model can say "Hei, dette er en test" without adding a 5-minute speech about climate change.

0 commit comments

Comments
 (0)