NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
HiFi-GAN for PyTorch
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
HiFi-GAN for PyTorch

HiFi-GAN model implements a spectrogram inversion model that allows to synthesize speech waveforms from mel-spectrograms.

Benchmarking

The following section shows how to run benchmarks measuring the model performance in training and inference mode.

Training performance benchmark

To benchmark the training performance on a specific batch size, run:

  • NVIDIA DGX A100 (8x A100 80GB)

    AMP=true NUM_GPUS=1 BS=64 GRAD_ACCUMULATION=8 EPOCHS=10 bash scripts/train.sh
    AMP=true NUM_GPUS=8 BS=64 GRAD_ACCUMULATION=1 EPOCHS=10 bash scripts/train.sh
    NUM_GPUS=1 BS=64 GRAD_ACCUMULATION=8 EPOCHS=10 bash scripts/train.sh
    NUM_GPUS=8 BS=64 GRAD_ACCUMULATION=1 EPOCHS=10 bash scripts/train.sh
    
  • NVIDIA DGX-1 (8x V100 16GB)

    AMP=true NUM_GPUS=1 BS=64 GRAD_ACCUMULATION=8 EPOCHS=10 bash scripts/train.sh
    AMP=true NUM_GPUS=8 BS=64 GRAD_ACCUMULATION=1 EPOCHS=10 bash scripts/train.sh
    NUM_GPUS=1 BS=64 GRAD_ACCUMULATION=8 EPOCHS=10 bash scripts/train.sh
    NUM_GPUS=8 BS=64 GRAD_ACCUMULATION=1 EPOCHS=10 bash scripts/train.sh
    

Each of these scripts runs for 10 epochs and measures the average number of items per second for each epoch. The performance results can be read from the nvlog.json files produced by the commands.

Inference performance benchmark

To benchmark the inference performance on a specific batch size, run:

  • For FP16

    AMP=true BATCH_SIZE=1 REPEATS=100 bash scripts/inference_benchmark.sh
    
  • For FP32 or TF32

    BATCH_SIZE=1 REPEATS=100 bash scripts/inference_benchmark.sh
    

The output log files will contain performance numbers for the HiFi-GAN model (number of input mel-spectrogram frames per second, reported as hifigan_frames/s) and FastPitch (number of output mel-spectrogram frames per second as mel_gen_frames/s). The inference.py script will run a few warm-up iterations before running the benchmark. Inference will be averaged over 100 runs, as set by the REPEATS env variable.

Results

The following sections provide details on how we achieved our performance and accuracy in training and inference.

Training accuracy results

Training accuracy: NVIDIA DGX A100 (8x A100 80GB)

Our results were obtained by running the ./platform/DGXA100_HiFi-GAN_{AMP,TF32}_8GPU.sh training script in the 21.12-py3 NGC container on NVIDIA DGX A100 (8x A100 80GB) GPUs. We present median mel loss values calculated on the validation subset at the end of the training.

DatasetBatch size / GPUGrad accumulationGPUsVal mel loss - FP32Val mel loss - mixed precisionTime to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
LJSpeech-1.1128119.659.68151.4 h117.1 h1.29x
LJSpeech-1.116189.659.6832.9 h32.8 h1.00x
Training accuracy: NVIDIA DGX-1 (8x V100 16GB)

Our results were obtained by running the ./platform/DGX1_HiFi-GAN_{AMP,FP32}_8GPU.sh training script in the 21.12-py3 NGC container on NVIDIA DGX-1 (8x V100 16GB) GPUs. We present median mel loss values calculated on the validation subset at the end of the training.

DatasetBatch size / GPUGrad accumulationGPUsVal mel loss - FP32Val mel loss - mixed precisionTime to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
LJSpeech-1.132419.659.73604.6 h279.7 h2.16x
LJSpeech-1.164219.659.73-240.2 h2.52x
LJSpeech-1.116189.659.7388.3 h56.7 h1.56x

Fine tuning of the model on FastPitch outputs makes about half of the steps of the base model and will prolong the training by 50%.

Training stability test

The training is stable when different random seeds are used. Below we compare loss curves obtained by training HiFi-GAN with different seeds.

Loss curves for different random seeds

The training is also stable with respect to different platforms:

Loss curves for different platforms

Training performance results

Training performance: NVIDIA DGX A100 (8x A100 80GB)

Our results were obtained by running the ./platform/DGXA100_HiFi-GAN_{AMP,TF32}_8GPU.sh training script in the 21.12-py3 NGC container on NVIDIA DGX A100 (8x A100 80GB) GPUs. Performance numbers, in input mel-scale spectrogram frames per second, were averaged over an entire training epoch.

Batch size / GPUGrad accumulationGPUsThroughput - TF32Throughput - mixed precisionThroughput speedup (TF32 to mixed precision)Strong scaling - TF32Strong scaling - mixed precision
1281112055.4415578.651.291.001.00
321436766.6340949.551.113.052.63
161855372.6355634.661.004.593.57
Training performance: NVIDIA DGX-1 (8x V100 16GB)

Our results were obtained by running the ./platform/DGX1_HiFi-GAN_{AMP,FP32}_8GPU.sh training script in the PyTorch 21.12-py3 NGC container on NVIDIA DGX-1 with 8x V100 16GB GPUs. Performance numbers, in output mel-scale spectrogram frames per second, were averaged over an entire training epoch.

Batch size / GPUGrad accumulationGPUsThroughput - FP32Throughput - mixed precisionThroughput speedup (FP32 to mixed precision)Strong scaling - FP32Strong scaling - mixed precision
32413017.576522.372.161.001.00
6421-7596.322.52-1.00
321412135.0423660.141.954.023.11
161820659.8632175.411.566.854.24

Inference performance results

The following tables show inference statistics for the FastPitch and HiFi-GAN text-to-speech system, gathered from 100 inference runs. Latency is measured from the start of FastPitch inference to the end of HiFi-GAN inference. Throughput is measured as the number of generated audio samples per second at 22KHz. RTF is the real-time factor that denotes the number of seconds of speech generated in a second of wall-clock time per input utterance.

Our results were obtained by running the ./scripts/inference_benchmark.sh script in the PyTorch 21.12-py3 NGC container. The input utterance has 128 characters, synthesized audio has 8.05 s.

Inference performance: NVIDIA DGX A100 (1x A100 80GB)

TorchScript + denoising:

Batch sizePrecisionAvg latency (s)Latency tolerance interval 90% (s)Latency tolerance interval 95% (s)Latency tolerance interval 99% (s)Throughput (samples/sec)Speed-up with mixed precisionAvg RTF
1FP160.0190.0210.0210.02289069581.29403.94
2FP160.0290.0290.0290.03117803581.97267.13
4FP160.0440.0450.0450.046152484171.57172.88
8FP160.0820.0820.0820.082165977931.5794.09
1TF320.0250.0250.0250.0256915487-313.63
2TF320.0570.0570.0570.0575966172-135.29
4TF320.070.0710.0710.0729710162-110.09
8TF320.1280.1290.1290.12910578539-59.97

TorchScript, no denoising:

Batch sizePrecisionAvg latency (s)Latency tolerance interval 90% (s)Latency tolerance interval 95% (s)Latency tolerance interval 99% (s)Throughput (samples/sec)Speed-up with mixed precisionAvg RTF
1FP160.0180.0190.0190.02094804321.32429.95
2FP160.0270.0280.0280.028124300262.02281.86
4FP160.0420.0440.0440.045159523961.60180.87
8FP160.0820.0830.0830.084164619101.5293.32
1TF320.0240.0250.0250.0257194880-326.3
2TF320.0550.0560.0560.0566141659-139.27
4TF320.0680.0680.0690.0699977333-113.12
8TF320.1250.1260.1260.12710813904-61.3
Inference performance: NVIDIA DGX-1 (1x V100 16GB)

TorchScript + denoising:

Batch sizePrecisionAvg latency (s)Latency tolerance interval 90% (s)Latency tolerance interval 95% (s)Latency tolerance interval 99% (s)Throughput (samples/sec)Speed-up with mixed precisionAvg RTF
1FP160.0330.0340.0350.03550622221.82229.58
4FP160.0830.0850.0850.08581063132.2991.91
8FP160.1420.1440.1440.14595011392.5453.86
1FP320.0610.0620.0620.0622783145-126.22
4FP320.1920.1940.1940.1953534640-40.08
8FP320.3620.3640.3640.3653747958-21.25

TorchScript, no denoising:

Batch sizePrecisionAvg latency (s)Latency tolerance interval 90% (s)Latency tolerance interval 95% (s)Latency tolerance interval 99% (s)Throughput (samples/sec)Speed-up with mixed precisionAvg RTF
1FP160.0300.0310.0310.03156736392.02257.31
4FP160.0800.0810.0810.08284726032.3796.06
8FP160.1390.1400.1410.14197378652.5755.20
1FP320.0600.0610.0610.0622806620-127.28
4FP320.1900.1920.1920.1933571308-40.49
8FP320.3580.3600.3610.3613788591-21.48
Inference performance: NVIDIA T4

TorchScript, denoising:

Batch sizePrecisionAvg latency (s)Latency tolerance interval 90% (s)Latency tolerance interval 95% (s)Latency tolerance interval 99% (s)Throughput (samples/sec)Speed-up with mixed precisionAvg RTF
1FP160.0600.0610.0610.06128350642.42128.57
4FP160.2110.2130.2130.21432056672.4236.35
8FP160.4100.4130.4130.41433040702.4518.73
1FP320.1450.1460.1470.1471171258-53.12
4FP320.5120.5150.5150.5161324952-15.02
8FP321.0061.0111.0121.0131347688-7.64

TorchScript, no denoising:

Batch sizePrecisionAvg latency (s)Latency tolerance interval 90% (s)Latency tolerance interval 95% (s)Latency tolerance interval 99% (s)Throughput (samples/sec)Speed-up with mixed precisionAvg RTF
1FP160.0570.0580.0580.05929693982.48134.67
4FP160.2050.2070.2070.20832991302.4537.41
8FP160.3990.4020.4030.40433890012.4819.21
1FP320.1420.1430.1430.1441195309-54.21
4FP320.5040.5070.5070.5091345995-15.26
8FP320.9930.9970.9980.9991365273-7.74

NVIDIA uses cookies to improve your experience on our web site. We and our third-party partners also use cookies and other tools to collect and record information you provide as well as information about your interactions with our websites for performance improvement, analytics, and to assist in marketing efforts. By clicking "Accept All", you consent to our use of cookies and other tools as described in our Cookie Policy. You can manage your cookie settings by clicking on "Manage Settings." By continuing to use this site or by clicking one of the buttons below, you agree to our Terms of Service (which contains important waivers). Please see our Privacy Policy for more information on our privacy practices.