NVIDIA
NVIDIA
Transformer for PyTorch
Resource
NVIDIA
NVIDIA
Transformer for PyTorch

This implementation of Transformer model architecture is based on the optimized implementation in Fairseq NLP toolkit.

Performance

Results

Training Accuracy Results

In order to test accuracy of our implementation we have run experiments with different seeds for 100 epochs with batch size 5120 per GPU and learining rate 6e-4 in the pytorch-18.12-py3 Docker container. Plot below shows BLEU score changes.
Accuracy plot

Training Performance Results

Running this code with the provided hyperparameters will allow you to achieve the following results. Our setup is a DGX-1 with 8x Tesla V100 16GB. We've verified our results after training 32 epochs to obtain multi-GPU and mixed precision scaling results.

GPU countMixed precision BLEUfp32 BLEUMixed precision training timefp32 training time
828.6928.43446 min1896 min
428.3528.31834 min3733 min

In some cases we can train further with the same setup to achieve slightly better results.

GPU countPrecisionBLEU scoreEpochs to trainTraining time
4fp1628.67741925 min
4fp3228.40475478 min

Results here are the best we achieved. We've observed a large variance in BLEU, while using random seed. Nearly all setups reach 28.4 BLEU, although the time it takes also varies between setups. We also observed a good rate of week scaling. We measured performance in tokens (words) per second.

GPU countMixed precisionFP32FP32/Mixed speedupMixed precision week scalingFP32 week scaling
13765086304.361.01.0
4132700305004.353.523.53
8260000610004.266.917.07

Inference performance results

All results were obtained by generate.py inference script in the pytorch-19.01-py3 Docker container. Inference was run on a single GPU.

GPUMixed precisionFP32FP16/Mixed speedup
Tesla V1005129.343396.091.51

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.