From 28a64221eaf6d6435d61d4ca72730bb994e22cc4 Mon Sep 17 00:00:00 2001 From: Thorsten Mueller Date: Sat, 19 Dec 2020 22:23:28 +0100 Subject: [PATCH] Improve robostness on cpu / gpu model mix --- TTS/bin/synthesize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TTS/bin/synthesize.py b/TTS/bin/synthesize.py index b08f9345..40852bdf 100644 --- a/TTS/bin/synthesize.py +++ b/TTS/bin/synthesize.py @@ -37,7 +37,8 @@ def tts(model, vocoder_model, text, CONFIG, use_cuda, ap, use_gl, speaker_fileid if CONFIG.model == "Tacotron" and not use_gl: mel_postnet_spec = ap.out_linear_to_mel(mel_postnet_spec.T).T if not use_gl: - waveform = vocoder_model.inference(torch.FloatTensor(mel_postnet_spec.T).unsqueeze(0)) + device_type = "cuda" if use_cuda else "cpu" + waveform = vocoder_model.inference(torch.FloatTensor(mel_postnet_spec.T).to(device_type).unsqueeze(0)) if use_cuda and not use_gl: waveform = waveform.cpu() if not use_gl: