Skip to main content

HIFI Gan vocoder
Progect report
Last updated: December 8, 2024
In this project HIFI gan for audio generation was implemented. Model architecture is described here https://arxiv.org/pdf/2010.05646.
Also to generate audio file from text use txt2mel.py (uses Tacotron2 to get mel-spectrogram). You can also generate audio from mel (audio -> mel -> audio) using inference.py.
Train params
HIFI Gan v1 was chosen as the architecture. All model parameters can be found in src/configs/model/hifi_gan.yaml file or in the mentioned article. For training src/configs/hifi_train.yaml config was used. Model was trained on LJ speech dataset (13k samples).
Some params:
- 100 epochs (400 iterations each)
- LR scheduler: StepLr (gamma = 0.999) (at first exponential was used on each iteration, but it is unnecessary to reproduce results)
- AdamW
- Clip grad norm param = 100 (for each component different clipping )
- Batch size = 16
Experiments and some plots
Main run (with final results) is shown in yellow at first, and then in pink.
Generated and original spectrogram on validation.

Experiments:
- Optimizers: I tried to use different oprimizers for generator and desriminator (violet on plots) had different LR parameters (descriminator lr was decreasing slower). However sound was to noisy to understand any text.
- Fast decreasing lr for both generator and descriminator (blue on plots). Model was not training after lr got lower then 1e-5.
- No gradient normalization (same as blue run). Without them gradients' norm where to high, therefore model was not training and generated only noise.
Results
Validation audio input and generated audio:
In AnyTask, you can find generated audio from example texts and audio. While audio generated from text has awesome quality (MOS score = 3.43 is equal to the input audio on example samples ) and even mel-spectrograms seem similar, audio generated from other audio has a robotic voice and other artifacts (MOS score = 1.8).
The difference between generated mel-spectrogram and original for audio-to-audio:


This effect is most likely to occur because of domain mismatch.
To conclude, the final model has great quality and works well on the same domain. However, when the domain is changed, the output audio quality is worse (has some artifacts of being generated).