Skip to content

BF667-IDLE/VCTrain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

542 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VCT Logo

Python TypeScript Next.js PyTorch FastAPI

20 Optimizers Full TypeScript WebSocket Colab Dark Mode Multi GPU

VCTrain

Enhanced RVC Training System with full TypeScript stack, 20 optimizers, Python FastAPI backend, WebSocket real-time monitoring, and Google Colab support.

📚 Documentation · ⚡ Quick Start · ☁️ Colab · 💻 Install · 🎨 WebUI · 🎯 Optimizers · 🔄 Workflow

Built on PolTrain · Full Documentation →


✨ What's New - Full TypeScript Stack (v0.4.1)

🎉 VCTrain is now fully TypeScript with optimized Colab support!

  • Frontend: Next.js 16 + TypeScript (all components, API client, WebSocket hook)
  • Bridge: TypeScript WebSocket bridge running on Bun
  • Backend: FastAPI + Pydantic type definitions
  • Colab: Node.js 20 LTS auto-install, fixed frontend startup
  • Type Safety: End-to-end type validation prevents runtime errors
  • Better Organization: Clean folder structure with ts/ directory

📚 New here? Check our Documentation for step-by-step tutorials!


📚 Documentation

Complete documentation is in the docs/ folder:

Resource Description Link
📖 Documentation Index All docs organized in docs/ folder Browse
🏠 Home Main documentation hub docs/wiki/Home.md
📦 Installation Complete setup guide docs/wiki/Installation-Guide.md
🎓 First Training Step-by-step tutorial docs/wiki/First-Training.md
☁️ Colab Guide Free GPU setup docs/wiki/Colab-Setup.md
🏗️ Architecture Technical deep dive docs/wiki/Architecture.md
⚡ Quick Reference Commands & tips docs/guides/Quickstart.md

⚡ Quick Start

Option 1: Google Colab (Recommended for Beginners)

Open In Colab

3 Steps to Training:

  1. Click "Open in Colab" button above
  2. Run all cells sequentially (takes ~5 minutes)
  3. Open ngrok URL → Start training in WebUI

What you need:

See Colab Setup Guide for detailed instructions.

Option 2: Local Installation (Recommended for Advanced Users)

# 1. Clone & Install
git clone https://github.com/BF667-IDLE/VCTrain.git
cd VCTrain

# Install Python deps
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
pip install fastapi uvicorn[standard] websockets

# Install frontend deps
curl -fsSL https://bun.sh/install | bash
bun install

# Download models
python download_files.py

# 2. Start everything
bun run dev:full

# 3. Open browser
# http://localhost:3000

Requirements:

  • Python 3.8+
  • Node.js 20.x LTS (18.18.0+ minimum)
  • PyTorch 2.0+ with CUDA
  • 8GB+ RAM (16GB+ recommended)

See Installation Guide for complete instructions.


☁️ Google Colab (Free GPU)

Open In Colab

Why Use Colab?

  • Free T4 GPU with 16GB VRAM
  • Zero setup - everything automated
  • Public access via ngrok tunnels
  • Persistent storage with Google Drive
  • Keep-alive prevents disconnection

Colab Notebook Features

Cell Purpose Time
1 GPU Check ~10s
2 Install Dependencies (Python only) ~3-5 min
3 Download Pre-trained Models ~1-2 min
4 Setup Advanced Client Files ~5s
5 Upload Dataset (Optional) ~1 min
6 Start Server + ngrok ~30s
7 Keep Alive + Monitoring Runs forever

Quick Colab Tips

  • Use T4 GPU: Runtime → Change runtime type → T4 GPU
  • Run cells in order: Don't skip cells
  • Don't stop Cell 7: Prevents disconnection
  • Use Ranger optimizer: Best for T4 GPU
  • Batch size 4-8: Don't exceed T4's 16GB VRAM
  • Save to Drive: Persist models across sessions

📚 Full guide: Colab-Setup


💻 Local Installation

Prerequisites

Requirement Version Notes
Python 3.8+ 3.10+ recommended
Node.js 18.18.0+ 20.x LTS recommended
PyTorch 2.0+ With CUDA for GPU
GPU Optional NVIDIA with CUDA 11.7+
RAM 8GB+ 16GB+ recommended

Installation Steps

Detailed guide: Installation-Guide

Quick version:

# 1. Clone repo
git clone https://github.com/BF667-IDLE/VCTrain.git && cd VCTrain

# 2. Install Python deps
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -r requirements.txt
pip install fastapi uvicorn[standard] websockets

# 3. Install frontend
bun install

# 4. Download models
python download_files.py

# 5. Start
bun run dev:full

Starting Services

Simple method (recommended):

python main.py
# Open: http://localhost:7860/client/

Or for development (3 services):

# Terminal 1 - Backend (FastAPI)
python main.py

# Terminal 2 - WebSocket Bridge (optional)
cd mini-services/ws-bridge && bun run index.ts

# Terminal 3 - Frontend (Next.js dev mode)
bun run dev

Open http://localhost:7860/client/ for advanced client or http://localhost:3000 for full WebUI


🎨 WebUI Features

Dashboard Tab

  • 📊 Experiment list from filesystem
  • 🚀 Active training jobs with live status
  • 🎮 GPU monitoring (name, memory, CUDA version)
  • 🔌 Connection indicator (backend online/offline)
  • Quick actions (New Training, Compare Models)

Training Config Tab

  • 📝 Complete form matching all train.py CLI arguments
  • 🎯 20 optimizers with live info panel
  • 💻 Live CLI command preview with copy button
  • 🚀 Starts real training via FastAPI backend
  • 🆔 Shows job ID on success

Training Monitor Tab

  • 📈 Real-time WebSocket metrics
  • 📊 4 interactive Recharts:
    • Loss Curves (discriminator, generator, mel, KL)
    • Mel Similarity (%) over epochs
    • Gradient Norms (G vs D)
    • Learning Rate Schedule
  • 📜 Scrollable log viewer - raw training output
  • 🎭 Demo mode with mock data when offline

Optimizer Guide Tab

  • 🏆 6 recommendation cards: Best Overall, Fastest, Memory Efficient, etc.
  • 📋 All 20 optimizers organized by category
  • Star ratings: Speed, Quality, Memory, Stability
  • 🔍 Click for details: Description, LR range, key features

📚 Full WebUI guide: WebUI-Dashboard


🎯 Optimizer Guide

VCTrain supports 20 different optimizers for RVC training:

Quick Picks

Goal Optimizer Batch Size Notes
Best Overall Ranger 8 RAdam + Lookahead, very stable
Best Quality Sophia 8 Curvature-aware, fast convergence
No LR Tuning Prodigy 8 Auto-adjusts LR, set lr=1.0
Memory Saver Adafactor 12 Lowest VRAM usage
Fastest SignSGD 16 Minimal memory per step

All Optimizers by Category

Category Optimizers Best For
Adaptive AdamW, Adam, AdaBelief, AdaBeliefV2, Adafactor, AMSGrad, RAdam, AdamP, Apollo, NovoGrad, LAMB Most use cases
Sign-Based Lion, SignSGD Memory efficiency
Second-Order Sophia, CAME Fast convergence
Hybrid Ranger, Lookahead Stability + quality
Auto-LR DAdaptAdam, Prodigy Zero tuning needed

📚 Full guide: Optimizer-Guide


🔄 Training Workflow

1. Prepare Dataset

  • Collect 10-60 minutes of clean speech
  • Save as WAV (recommended), FLAC, or MP3
  • Place in experiments/my_voice/raw/

2. Configure Training

# Or use WebUI form
python rvc/train/train.py \
  --experiment_dir "experiments" \
  --model_name "my_voice" \
  --total_epoch 300 \
  --batch_size 8 \
  --optimizer "AdamW"

3. Monitor Training

4. Completion

  • Training finishes automatically
  • Checkpoint saved to experiments/my_voice/
  • Use with RVC for voice conversion

📚 Full guide: Training-Workflow


📁 Project Structure

VCTrain/
├── client/                       # Advanced Client System
│   ├── html/                     # Pure HTML client
│   ├── css/                      # CSS styles
│   ├── js/                       # JavaScript
│   ├── python/                   # Python launchers
│   └── ts/                       # TypeScript/Next.js source
│
├── main.py                       # FastAPI server (serves client + API)
├── colab_simple_client.ipynb     # Simple Colab notebook (recommended)
├── colab_advanced_client.ipynb   # Full-featured Colab notebook
├── universal_client.py           # Universal launcher
├── deploy_colab.sh               # Colab deployment script
│
├── rvc/                          # Core training code (Python)
│   ├── train/                    # Training script + 20 optimizers
│   └── lib/                      # Algorithm implementations
│
├── src/                          # Next.js Frontend (TypeScript)
│   ├── app/                      # Next.js pages
│   ├── components/               # React components
│   └── lib/                      # API client, store, utils
│
├── web/                          # Built static frontend
│   ├── index.html                # Next.js export
│   └── client/                   # Advanced client (copy)
│
└── docs/                         # Documentation
    ├── wiki/                     # Wiki pages
    └── guides/                   # Quick guides

📚 Architecture details: Architecture


🔧 Commands Reference

Quick Start

python main.py                   # Start server (recommended)
python universal_client.py       # Universal launcher
python colab_simple_client.ipynb # Colab notebook

Development

bun run dev              # Frontend only (Next.js dev mode)
bun run build            # Build frontend for production
npm start                # Start backend only

Utilities

python download_files.py  # Download pre-trained models
bash deploy_colab.sh      # Deploy to Colab

🐛 Troubleshooting

Common Issues

Problem Solution
Frontend won't start Install Node.js 20.x LTS
CUDA out of memory Lower batch size or use Adafactor
Loss is NaN Lower learning rate or try Prodigy
Colab disconnects Don't stop keep-alive cell
Port already in use Kill process: lsof -ti:3000 | xargs kill

📚 Full troubleshooting: Troubleshooting

Getting Help


🎓 Learning Path

Beginner

  1. Installation-Guide - Get everything setup
  2. First-Training - Train your first model
  3. Colab-Setup - Use free GPU

Intermediate

  1. Optimizer-Guide - Learn about all 20 optimizers
  2. Dataset-Preparation - Prepare better datasets
  3. GPU-Configuration - Optimize for your hardware

Advanced

  1. Architecture - Understand the stack
  2. TypeScript-Stack - Type safety details
  3. API-Reference - Backend API documentation

🤝 Contributing

We welcome contributions! Here's how:

Development Setup

git clone https://github.com/BF667-IDLE/VCTrain.git
cd VCTrain
bun install
bun run dev:full

Guidelines

  • ✅ Follow TypeScript best practices
  • ✅ Write tests for new features
  • ✅ Update documentation
  • ✅ Use conventional commits

Areas We Need Help

  • Improve WebUI UX
  • Add dataset validation
  • Write integration tests
  • Translate documentation

📊 Tech Stack

Layer Technology Purpose
Frontend Next.js 16, React 19, TypeScript 5 WebUI
Styling Tailwind CSS 4, shadcn/ui Components
State Zustand, React Query Data management
Charts Recharts Real-time metrics
Bridge Bun, WebSocket REST proxy + WS relay
Backend FastAPI, Uvicorn, Pydantic API server
ML PyTorch 2.0+, CUDA Training pipeline
Audio librosa, pydub, ffmpeg Audio processing

📄 License

This project is built on top of PolTrain and follows the same license.


🙏 Acknowledgments


📈 Stats

GitHub stars GitHub forks GitHub issues


Happy Training! 🎤✨

Made with ❤️ by the VCTrain Team

About

Enhanced RVC Training System with 20 optimizers, full TypeScript WebUI (Next.js), Python FastAPI backend, and Google Colab support

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors