Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low inference speed of TTS on GPU #375

Open
dalvlv opened this issue Jul 17, 2022 · 2 comments
Open

Low inference speed of TTS on GPU #375

dalvlv opened this issue Jul 17, 2022 · 2 comments
Labels
question Further information is requested

Comments

@dalvlv
Copy link

dalvlv commented Jul 17, 2022

May I ask why the RTF of TTS is only 0.09 for a 12-seconds sentence? I use fastspeech2_HIFiGAN model and GPU is A2000 (8.0 capability). I thought it should be 50x speedup at least. Because the paper of fastpeech2 says it has 50x than transformer and HifiGAN says it speed up 1000x. So can anyone tells me what's wrong?
Thank you!

@kan-bayashi kan-bayashi added the question Further information is requested label Jul 21, 2022
@kan-bayashi
Copy link
Owner

Based on my experiments, it should be a bit more faster.
Using Nvidia T4, CFS2 + HiFiGAN V1 resulted in RTF = 0.008 (250 utts averaged.)
Could you paste your pseudo code to calculate RTF?

@dalvlv
Copy link
Author

dalvlv commented Jul 22, 2022

Hi @kan-bayashi ,
Thank you for answering my question!
I use the colab codes of this respository. The code is below:

with torch.no_grad():
 start = time.time()
 out_t2s = text2speech(x)
 wav = out_t2s["wav"]
    rtf = (time.time() - start) / (len(wav) / text2speech.fs)
    print(f"RTF = {rtf:5f}")

I tests 3 parts of the inference for a Chinese 24s sentence:
part 1: preprocess : 387ms
text = self.preprocess_fn("<dummy>", dict(text=text))["text"]
part2: CFS2 model: 701ms
part3: HiFiGAN: 24ms
RTF: sum-parts / 24s = 0.046
(yes, for longer sentences, RTF is faster because of FastSpeech)
It seems the preprocess&CFS2 costs most of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants