Delete egs/ami/ASR/xlsr_transducer/QUICKSTART_16GB.md
Browse files
egs/ami/ASR/xlsr_transducer/QUICKSTART_16GB.md
DELETED
|
@@ -1,215 +0,0 @@
|
|
| 1 |
-
# 🚀 Quick Start: XLSR-Transducer on 16GB GPU
|
| 2 |
-
|
| 3 |
-
## ✅ Your Setup
|
| 4 |
-
- **GPU**: 16GB ✓
|
| 5 |
-
- **Data**: 70 hours AMI IHM ✓
|
| 6 |
-
- **Goal**: Train XLSR-Transducer (Task-1: No task tokens)
|
| 7 |
-
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
## 📋 Pre-Training Checklist
|
| 11 |
-
|
| 12 |
-
### 1. Install HuggingFace Transformers
|
| 13 |
-
```bash
|
| 14 |
-
pip install transformers
|
| 15 |
-
```
|
| 16 |
-
|
| 17 |
-
### 2. Verify Setup
|
| 18 |
-
```bash
|
| 19 |
-
cd /workspace/icefall/egs/ami/ASR
|
| 20 |
-
python xlsr_transducer/verify_setup.py
|
| 21 |
-
```
|
| 22 |
-
|
| 23 |
-
Expected output:
|
| 24 |
-
```
|
| 25 |
-
✓ All checks passed! Ready to train.
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
---
|
| 29 |
-
|
| 30 |
-
## 🎯 Start Training (Single Command)
|
| 31 |
-
|
| 32 |
-
```bash
|
| 33 |
-
cd /workspace/icefall/egs/ami/ASR
|
| 34 |
-
|
| 35 |
-
# Phase 1: Train with FROZEN encoder (Recommended for 16GB)
|
| 36 |
-
./xlsr_transducer/run_16gb.sh --stage 1 --stop-stage 1
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
**This will:**
|
| 40 |
-
1. Verify data preparation ✓
|
| 41 |
-
2. Train decoder + joiner (frozen XLSR encoder)
|
| 42 |
-
3. Save checkpoints every epoch
|
| 43 |
-
4. Take ~2-3 hours on 16GB GPU
|
| 44 |
-
|
| 45 |
-
---
|
| 46 |
-
|
| 47 |
-
## 📊 Monitor Training
|
| 48 |
-
|
| 49 |
-
### GPU Memory (in another terminal):
|
| 50 |
-
```bash
|
| 51 |
-
watch -n 1 nvidia-smi
|
| 52 |
-
```
|
| 53 |
-
Expected: **5-8 GB used** (Phase 1 with frozen encoder)
|
| 54 |
-
|
| 55 |
-
### Training Progress (Tensorboard):
|
| 56 |
-
```bash
|
| 57 |
-
cd /workspace/icefall/egs/ami/ASR
|
| 58 |
-
tensorboard --logdir xlsr_transducer/exp_16gb/tensorboard
|
| 59 |
-
```
|
| 60 |
-
Then open: http://localhost:6006
|
| 61 |
-
|
| 62 |
-
---
|
| 63 |
-
|
| 64 |
-
## 🔧 Configuration (Pre-optimized for 16GB)
|
| 65 |
-
|
| 66 |
-
Located in: [run_16gb.sh](xlsr_transducer/run_16gb.sh)
|
| 67 |
-
|
| 68 |
-
```bash
|
| 69 |
-
world_size=1 # Single GPU
|
| 70 |
-
max_duration=80 # Batch size (optimized for 16GB)
|
| 71 |
-
accum_grad=4 # Gradient accumulation
|
| 72 |
-
use_fp16=1 # FP16 training (CRITICAL)
|
| 73 |
-
freeze_encoder=true # Phase 1: Frozen encoder
|
| 74 |
-
num_epochs=20 # Training epochs
|
| 75 |
-
base_lr=0.0005 # Learning rate
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
**Memory usage**: ~5-8 GB (safe for 16GB GPU) ✅
|
| 79 |
-
|
| 80 |
-
---
|
| 81 |
-
|
| 82 |
-
## 📈 Training Phases
|
| 83 |
-
|
| 84 |
-
### **Phase 1: Frozen Encoder** [RECOMMENDED START]
|
| 85 |
-
```bash
|
| 86 |
-
./xlsr_transducer/run_16gb.sh --stage 1 --stop-stage 1
|
| 87 |
-
```
|
| 88 |
-
- **Time**: 2-3 hours
|
| 89 |
-
- **Memory**: 5-8 GB ✅
|
| 90 |
-
- **WER**: ~25-30%
|
| 91 |
-
- **Safe for 16GB GPU**: ✅
|
| 92 |
-
|
| 93 |
-
### **Phase 2: End-to-End Finetune** [OPTIONAL]
|
| 94 |
-
```bash
|
| 95 |
-
# After Phase 1 completes:
|
| 96 |
-
./xlsr_transducer/run_16gb.sh --stage 2 --stop-stage 2
|
| 97 |
-
```
|
| 98 |
-
- **Time**: 1-2 hours
|
| 99 |
-
- **Memory**: 8-12 GB ⚠️ (monitor closely)
|
| 100 |
-
- **WER**: ~23-27% (2-3% improvement)
|
| 101 |
-
- **Recommendation**: Only if Phase 1 memory is stable
|
| 102 |
-
|
| 103 |
-
---
|
| 104 |
-
|
| 105 |
-
## 🆘 If OOM (Out of Memory) Occurs
|
| 106 |
-
|
| 107 |
-
### Quick Fix:
|
| 108 |
-
Edit [run_16gb.sh](xlsr_transducer/run_16gb.sh):
|
| 109 |
-
```bash
|
| 110 |
-
# Change line 23:
|
| 111 |
-
max_duration=60 # Reduce from 80 → 60
|
| 112 |
-
|
| 113 |
-
# Change line 27:
|
| 114 |
-
accum_grad=6 # Increase from 4 → 6
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
Then restart training:
|
| 118 |
-
```bash
|
| 119 |
-
./xlsr_transducer/run_16gb.sh --stage 1 --stop-stage 1
|
| 120 |
-
```
|
| 121 |
-
|
| 122 |
-
---
|
| 123 |
-
|
| 124 |
-
## 📂 Output Files
|
| 125 |
-
|
| 126 |
-
After training, you'll find:
|
| 127 |
-
|
| 128 |
-
```
|
| 129 |
-
xlsr_transducer/exp_16gb/
|
| 130 |
-
├── epoch-1.pt # Checkpoint after epoch 1
|
| 131 |
-
├── epoch-2.pt # Checkpoint after epoch 2
|
| 132 |
-
├── ...
|
| 133 |
-
├── epoch-20.pt # Final checkpoint
|
| 134 |
-
├── best-valid-loss.pt # Best validation checkpoint
|
| 135 |
-
├── tensorboard/ # Training logs
|
| 136 |
-
└── training-info.txt # Training configuration
|
| 137 |
-
```
|
| 138 |
-
|
| 139 |
-
---
|
| 140 |
-
|
| 141 |
-
## 🎓 Expected Results
|
| 142 |
-
|
| 143 |
-
### Phase 1 Only (Frozen Encoder):
|
| 144 |
-
| Metric | Value |
|
| 145 |
-
|--------|-------|
|
| 146 |
-
| Training time | 2-3 hours |
|
| 147 |
-
| GPU memory | 5-8 GB |
|
| 148 |
-
| Dev WER | ~25-30% |
|
| 149 |
-
| Model params (trained) | ~30M (decoder+joiner only) |
|
| 150 |
-
|
| 151 |
-
### Phase 1 + Phase 2 (End-to-End):
|
| 152 |
-
| Metric | Value |
|
| 153 |
-
|--------|-------|
|
| 154 |
-
| Training time | 4-6 hours total |
|
| 155 |
-
| GPU memory | 8-12 GB |
|
| 156 |
-
| Dev WER | ~23-27% |
|
| 157 |
-
| Model params (trained) | ~300M (all parameters) |
|
| 158 |
-
|
| 159 |
-
---
|
| 160 |
-
|
| 161 |
-
## 🎉 Next Steps After Training
|
| 162 |
-
|
| 163 |
-
### 1. Average Models
|
| 164 |
-
```bash
|
| 165 |
-
./xlsr_transducer/run_16gb.sh --stage 3 --stop-stage 3
|
| 166 |
-
```
|
| 167 |
-
|
| 168 |
-
### 2. Decode on Test Set
|
| 169 |
-
```bash
|
| 170 |
-
cd /workspace/icefall/egs/ami/ASR
|
| 171 |
-
# Decoding script to be created next
|
| 172 |
-
./xlsr_transducer/decode.sh
|
| 173 |
-
```
|
| 174 |
-
|
| 175 |
-
### 3. Start Task-2 Preparation
|
| 176 |
-
Once Task-1 training completes, we can:
|
| 177 |
-
- Add `[scd]` speaker change detection tokens
|
| 178 |
-
- Prepare multitask dataset
|
| 179 |
-
- Train Task-2 model
|
| 180 |
-
|
| 181 |
-
---
|
| 182 |
-
|
| 183 |
-
## 📝 Summary
|
| 184 |
-
|
| 185 |
-
**Your exact command to start:**
|
| 186 |
-
```bash
|
| 187 |
-
cd /workspace/icefall/egs/ami/ASR
|
| 188 |
-
pip install transformers # First time only
|
| 189 |
-
./xlsr_transducer/run_16gb.sh --stage 1 --stop-stage 1
|
| 190 |
-
```
|
| 191 |
-
|
| 192 |
-
**What happens:**
|
| 193 |
-
1. ✅ Verifies data (70h AMI)
|
| 194 |
-
2. ✅ Downloads XLSR-53 from HuggingFace
|
| 195 |
-
3. ✅ Trains decoder + joiner (frozen encoder)
|
| 196 |
-
4. ✅ Saves checkpoints every epoch
|
| 197 |
-
5. ✅ Completes in 2-3 hours
|
| 198 |
-
|
| 199 |
-
**Memory usage:**
|
| 200 |
-
- Phase 1: **5-8 GB** (frozen encoder) ✅ SAFE for 16GB
|
| 201 |
-
- Phase 2: **8-12 GB** (finetuned) ⚠️ Optional
|
| 202 |
-
|
| 203 |
-
---
|
| 204 |
-
|
| 205 |
-
## 💡 Pro Tips
|
| 206 |
-
|
| 207 |
-
1. **Start with Phase 1 only** - It's safe and gives good results
|
| 208 |
-
2. **Monitor GPU memory** with `nvidia-smi` - Should stay under 10 GB
|
| 209 |
-
3. **Check tensorboard** - Loss should decrease smoothly
|
| 210 |
-
4. **Phase 2 is optional** - Only run if you want 2-3% WER improvement
|
| 211 |
-
5. **OOM is fixable** - Just reduce `max_duration` and increase `accum_grad`
|
| 212 |
-
|
| 213 |
-
---
|
| 214 |
-
|
| 215 |
-
**Ready to train?** Run the command above and you're good to go! 🚀
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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