Tensorflowtts: What is an expected average training speed of Tacotron2?

Created on 13 Nov 2020  ·  23Comments  ·  Source: TensorSpeech/TensorFlowTTS

What I am seeing is about ~11s/it with v100 GPU. I just followed the latest instruction in this github. Did I miss something?

question ❓

All 23 comments

@jun-danieloh it should be 3-4s / 1it :))). The dataloader use fixed shape for training tacotron2 (use max_length of ur training mel) so maybe because ur max mel length is too long :)). The maximum mel length in ur data should be <= 850.

3-4s/1it is still to slow, i think someone should solve this problem: AR decoding cell is quite inefficient in tensorflow. basically 5-10 days for training tacotron model, which is pretty slow...

@nukes I totally agree with you. My tacotron2 in PyTorch shows 0.7~0.8 sec/it which is about 5x times faster with the better quality. Training speed is the biggest hurdle for me to use Tensorflow model.

@nukes Can you add more details about how decoding cell is quite inefficient in TF? I can probably work on this stuff to speed up the training speed myself.

@nukes I totally agree with you. My tacotron2 in PyTorch shows 0.7~0.8 sec/it which is about 5x times faster with the better quality. Training speed is the biggest hurdle for me to use Tensorflow model.

with r = 1 ?. can you share that repo :)), i can not believe that tacotron2 can train with 0.7~0.8 sec/it with r = 1 even it's mixed precision.

@dathudeptrai I am not able to share the repo at the moment. It is not mixed precision and r = 5.

@dathudeptrai I am not able to share the repo at the moment. It is not mixed precision and r = 5.

you can adjust my repo with r = 5 :)) it should run as fast as pytorch version. (https://github.com/TensorSpeech/TensorFlowTTS/blob/master/examples/tacotron2/conf/tacotron2.v1.yaml#L35)

@jun-danieloh it should be 3-4s / 1it :))). The dataloader use fixed shape for training tacotron2 (use max_length of ur training mel) so maybe because ur max mel length is too long :)). The maximum mel length in ur data should be <= 850.

@dathudeptrai What it the r value for 3-4s/it??

@jun-danieloh it should be 3-4s / 1it :))). The dataloader use fixed shape for training tacotron2 (use max_length of ur training mel) so maybe because ur max mel length is too long :)). The maximum mel length in ur data should be <= 850.

@dathudeptrai What it the r value for 3-4s/it??

r = 1

the reason why my tacotron is slower caused by static shape. That mean the decoder steps always equal by maximum length of the training mel-spectrogram. So if ur training data have some samples that its length > 1000 then the training speed will so slow :)). The maximum length should be <= 850 :D.

@dathudeptrai
Is it static for all batches? Static shape changes every batch or is it fixed at the beginning of the training?

@dathudeptrai
I think you originally had the code below in tacotron_dataset.py. Did you take this out?

        datasets = datasets.filter(
            lambda x: x["mel_lengths"] <=850
        )

@dathudeptrai
I think you originally had the code below in tacotron_dataset.py. Did you take this out?

        datasets = datasets.filter(
            lambda x: x["mel_lengths"] <=850
        )

yes, you should do that :)). 750-850 is good.

the reason why my tacotron is slower caused by static shape. That mean the decoder steps always equal by maximum length of the training mel-spectrogram. So if ur training data have some samples that its length > 1000 then the training speed will so slow :)). The maximum length should be <= 850 :D.

Is there any way to have it dynamic? Is the max length set at the beginning of the training and does it last for the remaining training iterations without any changes?

the reason why my tacotron is slower caused by static shape. That mean the decoder steps always equal by maximum length of the training mel-spectrogram. So if ur training data have some samples that its length > 1000 then the training speed will so slow :)). The maximum length should be <= 850 :D.

Is there any way to have it dynamic? Is the max length set at the beginning of the training and does it last for the remaining training iterations without any changes?

the default value is dynamic, see here (https://github.com/TensorSpeech/TensorFlowTTS/blob/master/examples/tacotron2/conf/tacotron2.v1.yaml#L55). But it will cause training 2x slower, static shape is much faster. You can switch it to True and only training the mel that its length <= 850. You should read the readme carefully :))) (https://github.com/TensorSpeech/TensorFlowTTS/tree/master/examples/tacotron2#some-important-notes)

@dathudeptrai I really appreciate for your detailed explanations :) Let me go through README more carefully.

Can I ask one last question? Does static shape mean for every batch or for an entire training set? What I mean by that is the value of max length changes every batch based on the longest one in a batch or is it set at the beginning of the training?

s it set at the beginning of the traini

it set at the beginning of the training :)). That mean all batch will padded to maximum length :)))

@dathudeptrai Really appreciate for your detailed explanations :):)

@nukes I totally agree with you. My tacotron2 in PyTorch shows 0.7~0.8 sec/it which is about 5x times faster with the better quality. Training speed is the biggest hurdle for me to use Tensorflow model.

Some people told me the same result as yours:Pytorch is much faster for training tacotron. I saw your discussion with @dathudeptrai . Basically i think use static shape compromises between training data usage and training speed, which still cannot fundamentally solve this problem. I do not exactly know which part in AR decoding slows down the training. but the while loop should be optimized in my opinion. Maybe someone should profile the training process with tf-profiler and optimize it. a optimal way maybe someone could rewrite the decoding loop into tensorflow kernel/ops in c++ level to decoding all the frames within on op( removing the tf.while).

@dathudeptrai The refer below is not available. Can you point me to other similar commits or posts?

use_fixed_shapes: false    # use_fixed_shapes for training (2x speed-up)
                           # refer (https://github.com/dathudeptrai/TensorflowTTS/issues/34#issuecomment-642309118)

@jun-danieloh i can confirm that in my case fixed_shapes = True is 2x faster. But there is a man report that fixed_shapes=False is faster, you can refer this comment (https://github.com/tensorspeech/TensorflowTTS/issues/34#issuecomment-642309118)

@dathudeptrai I can also confirm that fixed_shapes = True shows 2x faster training speed. Let me check why this helps. Does fixed_shapes shows any quality degradations?

@dathudeptrai I can also confirm that fixed_shapes = True shows 2x faster training speed. Let me check why this helps. Does fixed_shapes shows any quality degradations?

there are no quality degradations here :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sujeendran picture sujeendran  ·  10Comments

jun-danieloh picture jun-danieloh  ·  6Comments

tienanh-1999 picture tienanh-1999  ·  6Comments

ZDisket picture ZDisket  ·  10Comments

learnerkun picture learnerkun  ·  5Comments