CoolFace
Apppublic

iteratehack/voice-model-rl-training

sourceHugging Facemitupdated 10mo agoView on Hugging Face
0likes
App README

Voice Model RL Training

Train open-source voice models using Reinforcement Learning with PPO and REINFORCE algorithms.

Features

  • โ€”๐ŸŽฏ Multiple RL Algorithms: Choose between PPO and REINFORCE
  • โ€”๐Ÿš€ GPU Acceleration: Automatic GPU detection and usage
  • โ€”๐Ÿ“Š Real-time Monitoring: Track training progress in real-time
  • โ€”๐ŸŽต Model Comparison: Compare base vs trained models
  • โ€”๐Ÿ’พ Checkpoint Management: Automatic model saving and loading
  • โ€”๐ŸŽค Multiple Base Models: Support for Wav2Vec2, WavLM, and more

Supported Models

  • โ€”Facebook Wav2Vec2 (Base & Large)
  • โ€”Microsoft WavLM Base Plus
  • โ€”Any compatible HuggingFace speech model

How to Use

1. Training Tab

  1. 1.Select Base Model: Choose from available pretrained models
  2. 2.Configure Algorithm: Select PPO (recommended) or REINFORCE
  3. 3.Set Parameters:
  4. 4.Episodes: 10-100 (start with 20 for testing)
  5. 5.Learning Rate: 1e-5 to 1e-3 (default: 3e-4)
  6. 6.Batch Size: 4-64 (depends on GPU memory)
  7. 7.Start Training: Click "Start Training" and monitor progress

2. Compare Results Tab

  1. 1.Upload Audio: Provide a test audio sample
  2. 2.Generate Comparison: Process through both models
  3. 3.Listen: Compare base vs trained model outputs

Reward Functions

The training optimizes for three key metrics:

  • โ€”Clarity (33%): Audio signal quality and noise reduction
  • โ€”Naturalness (33%): Natural speech patterns and prosody
  • โ€”Accuracy (34%): Fidelity to original content

Hardware Requirements

  • โ€”CPU: Works but slow (5-10 min per episode)
  • โ€”GPU: Recommended (T4 or better) (1-2 min per episode)
  • โ€”Memory: 8GB+ RAM, 4GB+ VRAM

Technical Details

RL Algorithms

PPO (Proximal Policy Optimization)

  • โ€”More stable training
  • โ€”Uses value function
  • โ€”Better for most cases
  • โ€”Slightly slower per episode

REINFORCE

  • โ€”Simpler algorithm
  • โ€”Higher variance
  • โ€”Faster per episode
  • โ€”May need more episodes

Training Process

  1. 1.Load pretrained base model
  2. 2.Add RL policy/value heads
  3. 3.Train using custom reward function
  4. 4.Save checkpoints periodically
  5. 5.Generate comparisons

Local Development

Clone and run locally:

bash
git clone https://huggingface.co/spaces/USERNAME/voice-model-rl-training
cd voice-model-rl-training
pip install -r requirements.txt
python app.py

Repository Structure

voice-rl-training/
โ”œโ”€โ”€ app.py                 # Main Gradio application
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”œโ”€โ”€ README.md             # This file
โ”œโ”€โ”€ voice_rl/             # Core training modules
โ”‚   โ”œโ”€โ”€ models/           # Model wrappers
โ”‚   โ”œโ”€โ”€ rl/               # RL algorithms
โ”‚   โ”œโ”€โ”€ training/         # Training orchestration
โ”‚   โ”œโ”€โ”€ data/             # Data handling
โ”‚   โ”œโ”€โ”€ monitoring/       # Metrics and visualization
โ”‚   โ””โ”€โ”€ evaluation/       # Model evaluation
โ””โ”€โ”€ workspace/            # Training outputs (git-ignored)