HiFi-GAN

repository·master·Indexed 25 days ago

https://github.com/jik876/hifi-gan

A Generative Adversarial Network for efficient and high-fidelity speech synthesis. The library supports training, fine-tuning with mel-spectrograms, and audio reconstruction via inference scripts. It includes configurations for V1, V2, and V3 generator versions and provides support for datasets such as LJ Speech and VCTK.

Tokens
797
Snippets
4
Records
6
Agent score
32%

What's inside HiFi-GAN

  1. Setup HiFi-GAN Pre-requisites

    master

    To set up the HiFi-GAN environment, ensure you meet the following requirements:

    1. Python: Version 3.6 or higher.
    2. Repository: Clone the HiFi-GAN repository.
    3. Dependencies: Install required Python packages listed in requirements.txt.
    4. Dataset: Download and extract the LJ Speech dataset and move all .wav files to the LJSpeech-1.1/wavs directory.
  2. Perform end-to-end speech synthesis inference

    master

    To generate audio directly from mel-spectrograms (e.g., from Tacotron2 or Glow-TTS):

    1. Create a directory named test_mel_files and copy your generated mel-spectrogram files into it.
    2. Run inference_e2e.py providing the path to a generator checkpoint.

    Generated audio is saved to generated_files_from_mel by default. Use the --output_dir option to specify a different destination.

    python inference_e2e.py --checkpoint_file [generator checkpoint file path]
  3. Train HiFi-GAN

    master

    You can train the HiFi-GAN generator using the train.py script. By default, checkpoints and configuration copies are saved in the cp_hifigan directory.

    To train different versions (V1, V2, or V3), select the corresponding configuration file (config_v1.json, config_v2.json, or config_v3.json).

    Use the --checkpoint_path option to specify a custom directory for saving checkpoints.

    python train.py --config config_v1.json
  4. Fine-tune HiFi-GAN

    master

    Fine-tuning allows you to adapt the model to new data using mel-spectrograms.

    Steps:

    1. Prepare Mel-spectrograms: Generate mel-spectrograms in .npy format (using a tool like Tacotron2 with teacher-forcing). The filename must match the original audio file (e.g., LJ001-0001.wav $\rightarrow$ LJ001-0001.npy).
    2. Organize Data: Create a directory named ft_dataset and copy all .npy files into it.
    3. Execute Training: Run train.py with the --fine_tuning flag set to True.
    python train.py --fine_tuning True --config config_v1.json
  5. Perform inference from wav files

    master

    To reconstruct audio from existing .wav files (mel-spectrogram inversion):

    1. Create a directory named test_files and copy your target .wav files into it.
    2. Run inference.py providing the path to a generator checkpoint.

    Generated audio is saved to generated_files by default. Use the --output_dir option to specify a different destination.

    python inference.py --checkpoint_file [generator checkpoint file path]
  6. Reference: Pretrained Model Folders

    master

    The following pretrained models are available for use:

    Folder NameGeneratorDatasetFine-Tuned
    LJ_V1V1LJSpeechNo
    LJ_V2V2LJSpeechNo
    LJ_V3V3LJSpeechNo
    LJ_FT_T2_V1V1LJSpeechYes (Tacotron2)
    LJ_FT_T2_V2V2LJSpeechYes (Tacotron2)
    LJ_FT_T2_V3V3LJSpeechYes (Tacotron2)
    VCTK_V1V1VCTKNo
    VCTK_V2V2VCTKNo
    VCTK_V3V3VCTKNo
    UNIVERSAL_V1V1UniversalNo