How jik876/hifi-gan works
HiFi-GAN is a neural audio-generation project: it trains GAN vocoders and provides two inference workflows, converting either WAV input or precomputed mel spectrograms into generated WAV output. Training prepares audio/mel examples, optimizes a generator against period- and scale-based discriminators, and validates and checkpoints the model. Inference loads a configured checkpoint and runs the generator. The README also documents fine-tuning with externally generated mel files and V1/V2/V3 model configurations. Relationships below follow the excerpts and README; unsampled implementation details are not assumed.
Main entry points: train.py Training Loop · inference.py WAV Inference · inference_e2e.py Mel Inference · models.py Waveform Generator
Components 18
Audio Data
- WAV Inputs
- Mel Inputs
- Dataset Manifests
LJSpeech-1.1/training.txt - Mel Dataset
meldataset.py
GAN Training
- V1 Config
config_v1.json - V2 Config
config_v2.json - V3 Config
config_v3.json - Training Loop
train.py - Training Utilities
utils.py
Vocoder Models
- Waveform Generator
models.py - Period Discriminator
models.py - Scale Discriminator
models.py - GAN Losses
models.py - Config Attributes
env.py
Audio Generation
- WAV Inference
inference.py - Mel Inference
inference_e2e.py - Generated WAVs
Other components
- User
Connections 25
- User → Training Loop: starts training
README.md - User → WAV Inference: runs inference
README.md - User → Mel Inference: runs synthesis
README.md - WAV Inputs → WAV Inference: provides audio
README.md - Mel Inputs → Mel Inference: provides spectrograms
README.md - Dataset Manifests → Mel Dataset: lists examples
meldataset.py - Training Loop → Dataset Manifests: loads file lists
train.py - Training Loop → Mel Dataset: constructs datasets
train.py - Training Loop → Waveform Generator: optimizes generator
train.py - Training Loop → Period Discriminator: trains discriminator
train.py - Training Loop → Scale Discriminator: trains discriminator
train.py - Training Loop → GAN Losses: computes losses
train.py - Training Loop → Training Utilities: saves checkpoints
train.py - Waveform Generator → Training Utilities: uses initialization
models.py - Training Loop → V1 Config: selects configuration
README.md - Training Loop → V2 Config: selects configuration
README.md - Training Loop → V3 Config: selects configuration
README.md - WAV Inference → Config Attributes: loads attributes
inference.py - Mel Inference → Config Attributes: loads attributes
inference_e2e.py - Training Loop → Config Attributes: uses attributes
train.py - WAV Inference → Mel Dataset: computes mel features
inference.py - WAV Inference → Waveform Generator: generates waveform
inference.py - Mel Inference → Waveform Generator: generates waveform
inference_e2e.py - WAV Inference → Generated WAVs: writes audio
inference.py - Mel Inference → Generated WAVs: writes audio
inference_e2e.py