Tacotron2 + WaveRNN experiments
Tacotron2: https://arxiv.org/pdf/1712.05884.pdf WaveRNN: https://github.com/erogol/WaveRNN forked from https://github.com/fatchord/WaveRNN
The idea is to add Tacotron2 as another alternative if it is really useful then the current model.
- [x] Code boilerplate tracotron2 architecture.
- [x] Train Tacotron2 and compare results (Baseline)
- [x] Train TTS current model in a comparable size with T2. (Current TTS model has 7M and Tacotron2 has 28M parameters)
- [x] Add TTS specific architectural changes to T2 and compare with the baseline.
- [x] Train WaveRNN a vocoder on generated spectrograms
- [x] Train a better stopnet. Stopnet sometimes misses the prediction that leads to unstable predictions. Maybe it is better to use a RNN as previous TTS version.
- [x] Release LJspeech Tacotron 2 model. (soon)
- [x] Release LJSpeech WaveRNN model. (https://github.com/erogol/WaveRNN)
Best result so far: https://soundcloud.com/user-565970875/ljspeech-logistic-wavernn
Some findings:
- Adding an entropy loss for the attention seems to improve the cases hard to learn the alignment. It forces network to learn more sparse and noise free alignment weights.
entropy = torch.distributions.Categorical(probs=alignments).entropy()
entropy_loss = (entropy / np.log(alignments.shape[1])).mean()
loss += 1e-4 * entropy_loss
Here is the alignment with entropy loss. However, if you keep the loss weight high, then it degrades the model's generalization for new words.

- Replacing Prenet with a BatchNorm version ehnace the performance quite a lot.
- A network with BN Prenet is harder to learn the attention. It looks like the network needs a level of noise onto autoregressive connection to relate encoder output to network output. Otwerwise, in teacher forcing mode, network does not need encoder output since it finds previous prediction frame enough to generate the next frame.
- Forward attention seems more robust to longer sequences and faster to align. (https://arxiv.org/abs/1807.06736)
Tacotron2 baseline implementation aligns after 35K iterations.

Also it gives better melspectrograms L1 loss compared to Tacotron1. Tacotron2 trained 150K iters and Tacotron trained 320K,
Tacotron1 loss: 0.34 Decoder loss: 0.3115 Postnet loss: 0.2985
Tacotron2 + TTS updates aligns much faster after 14K. It also reaches the same loss values of the baseline implementation which it gets after 100K

Here is the attention alignment after 14K

Here is the first WaveRNN based result.
https://soundcloud.com/user-565970875/wavernn-taco2

Here is a pocket article read by the mode WaveRNN + Tacotron2 Tacotron2 - 90k iterations WaveRNN - 550K iterations https://soundcloud.com/user-565970875/pocket-article-wavernn-and-tacotron2
@erogol Awesome results. Did you train tacotron2 with batch size of 32 and r=1? Was it done on multi-gpu or just one?
@erogol Fatcord's wavernn works very well with 10 bit audio as well, which helps to eliminate quite a bit of the background static.
@ZohaibAhmed I trained it with 4 GPUs with 16 batch size per GPU which is the max I can fit into a 1080ti. Much better results are coming through with couple of architectural changes.
@G-Wang thx for pointing. I am going to try. I just trained WaveRNN once and now I plan to discover some model updates and quantization schemes. I ll let you know here
I'm currently pretty happy with https://github.com/h-meru/Tacotron-WaveRNN/blob/master/README.md
I struggled some time when I integrated a similar model (something between that and the amazon universal vocoder architecture) but in the end I found the reason was just the Noam LR scheme performed much worse than just the fixed LR with Adam which in the worst case I could just reduce a little bit manually when the loss starts to behave funny. But for LJ the loss function is decreasing textbook-like.
Training WaveRNN with 10bit quantization. Also the final solution in #50 improved the model performance significantly. Results soon to be shared...
@erogol I've tried a few variants such as mu-law, gaussian/beta output, mixture logistics, but I found 9 and 10-bit at the end of the day gave the best result and fastest training, you can hear some samples here: https://github.com/G-Wang/WaveRNN-Pytorch
@erogol There is also a highly optimized pytorch and C++ implementation which I am training on the output of TTS extract_features script: https://github.com/geneing/WaveRNN-Pytorch
@erogol Is your solution to #50 checked into master branch?
@geneing that's cool. After a certain point, we can definitely consult to your repo for inference optimization. @reuben might also find it interesting.
@geneing not yet, needs a bit of testing but soon with the trained model.
@erogol thanks erogol. When could we use the tacotron2 + WaveRNN model to train on our datasets?
Is any pretrained wavernn model available for test?
This is the latest result. 10 bit WaveRNN trained for 400K initiazlied from 9 bit model Tacotron2 trained for 170K - postnetloss: 0.019 decoderloss: 0.023
Problems:
- There is high peak with "s" sound due to the dataset quality
- Static background noise due to 10 bit quantization
- Some intonation problems due to false Tacotron2 alignment. Maybe it is better to use an earlier checkpoint.
Below is the comparison of BN vs Dropout prenets as explain in #50

Audio Sample: https://soundcloud.com/user-565970875/commonvoice-1
Audio Sample with the best GL based model: https://soundcloud.com/user-565970875/sets/ljspeech-model-185k-iters-commit-db7f3d3
Interesting results! Do you use ground truth aligned mel specs generated by tacotron for training the neural vocoder, or do you train it from features extracted from the recordings?
@m-toman I don't see what you mean by the second option
I trained it with the specs from tacotron with teacher forcing.
Thanks, with the second option I mean just calculating Mel specs from the recordings and then training on those, without using Tacotron at all. This had a lower MOS in the WaveNet paper so I wondered which approach you used.
In the Amazon universal vocoder paper they did that (I assume) because they train from lots of data from many different speakers and recording conditions, so it's a trickier to use GTA mel specs (although you could do it with a very large multispeaker model I suppose)
@m-toman I was not aware that they show better results by using ground-truth mels specs. However, it does not really make sense to me (without any experimentation) since I believe vocoder is able to learn to obviate the mistakes done by the first network as it is trained with synthesized specs. But I guess to be sure, I need to try first.
No, they were worse (lower MOS 1-5 with 5 as the best score) as expected. Just checked, it wasn't in the Wavenet paper, it was in the Taco2 paper: https://arxiv.org/pdf/1712.05884.pdf in 3.3.1
"As expected, the best performance is obtained when the features used for training match those used for inference. However, when trained on ground truth features and made to synthesize from predicted features, the result is worse than the opposite. This is due to the tendency of the predicted spectrograms to be oversmoothed and less detailed than the ground truth – a consequence of the squared error loss optimized by the feature prediction network. When trained on ground truth spectrograms, the network does not learn to generate high quality speech waveforms from oversmoothed features."
So that's fine. Is there a script in the repo to produce the teacher forced data for the training set?