home/ modules/ training-a-rave-timbre-model

Training a RAVE Timbre Model End to End

  • learner can prepare a homogeneous dataset and run RAVE's two-phase training with gin configs
  • learner can diagnose training via TensorBoard, judge quality by ear, and fix discriminator instability
  • learner can choose a config and latent size and export a streaming model for realtime use

Train (or fully spec a training run for) a RAVE model on a homogeneous instrument dataset: prepare and augment the dataset, pick a config, run reconstruction-then-adversarial phases with beta warmup, monitor via TensorBoard while judging by ear, apply the discriminator-period fix if phase 2 destabilizes, truncate the latent by PCA fidelity, and export a --streaming .ts.

This module builds toward the defining move of neural-audio live performance: training your own timbre. A stock RAVE checkpoint gives you someone else’s instrument; a model trained on your own corpus — a prepared piano, a modular patch, your voice — becomes a personal synthesizer you can play through nn~ in Max/PD or the RAVE VST mid-set. That’s a days-long GPU commitment, so the craft here is making one run count rather than iterating blindly.

The arc starts fully supported: with a supplied homogeneous corpus, the learner preprocesses it into a chunked database and reads how homogeneity-versus-diversity balance shapes latent quality, adding mute/compress/gain augmentations for small datasets. Next comes a launch on a chosen architecture config — the config-selection tradeoffs (quality, VRAM, continuous vs discrete latents) and the gin-config system are the JIT how-tos here — with the two-phase training structure and beta warmup explaining what the run will do and why. The middle exercises are diagnostic: reading TensorBoard’s distance and fidelity logs, and — critically — judging validation audio by ear, because adversarial losses do not track perceptual quality. These two monitoring habits are the part-task drills: they recur every few hours across any real run and must become reflexive. The unsupported capstone then hands the learner a dataset and nothing else, expecting them to spec and run the whole pipeline, apply the discriminator-period fix if phase 2 wobbles, pick a latent size from the PCA fidelity curve, and export a streaming TorchScript file that won’t click in a realtime host.

Every required atom is load-bearing for that capstone — skip one and the run fails or the export is unusable. The supporting set deepens the picture: VAE mechanics and reparametrization, feature-matching and EMA internals, lazy datasets, hardware and Colab paths, and adjacent config-management cultures.

Atoms in this module

Required — these gate the capstone

RAVE is a variational autoencoder that encodes audio into a compact latent space and decodes it back in realtime
Concept L2 First instrument KB
RAVE requires hours of homogeneous audio preprocessed into a chunked database before training
Procedure L2 First instrument K
RAVE dataset quality needs a balance between homogeneity and diversity
Principle L2 First instrument K
RAVE supports mute, compress, and gain augmentations to improve generalization on small datasets
Principle L2 First instrument K
RAVE uses gin-config to define and override model hyperparameters without modifying code
Procedure L2 First instrument KN
RAVE architecture configs trade reconstruction quality, GPU memory, and control modality
Concept L3 Craft K
RAVE trains in two sequential phases: reconstruction first, adversarial refinement second
Concept L3 Craft K
RAVE ramps the KL regularization weight over a warmup schedule to avoid posterior collapse
Concept L3 Craft K
RAVE training is monitored via TensorBoard distance, fidelity, and adversarial-loss logs
Procedure L2 First instrument K
RAVE perceptual quality must be judged by ear, since adversarial loss values do not track it
Principle L2 First instrument K
Raising RAVE's discriminator update period fixes phase-2 instability when the discriminator is too strong
Procedure L3 Craft K
RAVE's exported latent size is chosen by a fidelity threshold on the PCA explained-variance curve
Concept L3 Craft K
RAVE models must be exported with --streaming to avoid click artifacts in realtime hosts
Procedure L2 First instrument KN

Supporting — enrichment, not gating

RAVE's variational encoder reparametrizes latent samples using the mean and log-variance trick
Concept L3 Craft K
A VAE generates sound by encoding a spectrogram to a latent point, decoding it, and inverting the STFT
Concept L2 First instrument K
VAEs support two generation modes: reconstruction from an encoded input and sampling from the latent prior
Concept L2 First instrument K
Feature matching loss in RAVE aligns intermediate discriminator activations between real and generated audio
Concept L3 Craft K
Exponential Moving Average of weights produces smoother RAVE models by averaging checkpoints over time
Concept L3 Craft K
RAVE's phase 1 length is a fixed step count, not a quality-based stopping criterion
Concept L3 Craft K
RAVE's lazy dataset mode avoids disk conversion by loading raw audio files at training time
Concept L2 First instrument KN
RAVE requires a CUDA GPU with 5–32 GB VRAM depending on config, and hours of audio
Fact L1 Foundations KN
RAVE training requires CUDA verified via nvidia-smi and a dedicated conda environment
Procedure L1 Foundations KN
A community Google Colab notebook enables RAVE training without local GPU hardware
Fact L1 Foundations KN
Gin's @gin.register limits side-effects by only injecting defaults when a function is used as an argument
Concept L3 Craft K
Dora manages ML experiment configurations via content-addressed signatures rather than manual naming
Concept L4 Performance K