PyTorch implementation of Natural TTS Synthesis By Conditioning Wavenet On Mel Spectrogram Predictions.
This implementation includes distributed and automatic mixed precision support and uses the LJSpeech dataset.
Distributed and Automatic Mixed Precision support relies on NVIDIA's Apex and AMP.
Visit our website for audio samples using our published Tacotron 2 and WaveGlow models.
- NVIDIA GPU + CUDA cuDNN
- Clone this repo:
git clone https://github.com/taneliang/tacotron2.git
- CD into this repo:
cd tacotron2
- Initialize submodule:
git submodule init; git submodule update
- Check CUDA toolkit version:
nvcc --version
. NB: This is the toolkit version, which may be different from the version reported by nvidia-smi. - Create Python 3 virtual environment:
python3 -m venv .env-cuda<CUDA version>
- Activate venv, by running one of the following:
bash
/sh
:source .env-cudaxxx/bin/activate
csh
:source .env-cudaxxx/bin/activate.csh
fish
:source .env-cudaxxx/bin/activate.fish
- Install PyTorch 1.0. As the time this was written, these are the instructions:
- CUDA 10.0:
pip install torch==1.4.0+cu100 torchvision==0.5.0+cu100 -f https://download.pytorch.org/whl/cu100/torch_stable.html
- CUDA 10.1:
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
- CUDA 10.2 or 11.0:
pip install torch torchvision
- CUDA 10.0:
- Install Apex:
pushd .. git clone https://github.com/NVIDIA/apex cd apex pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./ popd
- Install Python requirements:
pip install -r requirements.txt
If running with access to NUS School of Computing resources (e.g. Sunfire, compute cluster), you can copy the training dataset from the cgpb0
compute cluster machine:
scripts/copy_dataset.sh
Otherwise, you can set up the data from scratch:
- EmoV-DB:
- Download the EmoV-DB dataset
- Normalize it:
ls */*/*.wav | xargs -I % sh -c 'mkdir -p ../out/$(dirname %) && sox % --rate 16000 -c 1 -b 16 ../out/%'
- LJSpeech:
- Download the LJSpeech dataset.
- Normalize it:
mkdir ../../LJSpeech-1.1/wavs && ls *.wav | xargs -I % sh -c 'sox % --rate 16000 -c 1 -b 16 ../../LJSpeech-1.1/wavs/%'
- Generate filelist files:
cd scripts vim ./genfilelist.py # Configure the script ./genfilelist.py cd ..
python train.py --output_directory=outdir --log_directory=logdir
- (OPTIONAL)
tensorboard --logdir=outdir/logdir
Training using a pre-trained model can lead to faster convergence
By default, the dataset dependent text embedding layers are ignored
- Download our published Tacotron 2 model
python train.py --output_directory=outdir --log_directory=logdir -c tacotron2_statedict.pt --warm_start
python -m multiproc train.py --output_directory=outdir --log_directory=logdir --hparams=distributed_run=True,fp16_run=True
- Download our published Tacotron 2 model
- Download our published WaveGlow model
jupyter notebook --ip=127.0.0.1 --port=31337
- Load inference.ipynb
N.b. When performing Mel-Spectrogram to Audio synthesis, make sure Tacotron 2 and the Mel decoder were trained on the same mel-spectrogram representation.
WaveGlow Faster than real time Flow-based Generative Network for Speech Synthesis
nv-wavenet Faster than real time WaveNet.
This implementation uses code from the following repos: Keith Ito, Prem Seetharaman as described in our code.
We are inspired by Ryuchi Yamamoto's Tacotron PyTorch implementation.
We are thankful to the Tacotron 2 paper authors, specially Jonathan Shen, Yuxuan Wang and Zongheng Yang.