Waveglow Cpu Inferencing

I am trying to produce the inference results of tacotron2 and waveglow model on CPU. I have changed all the cuda tensors to cpu in denoiser.py, glow.py and all the files in which changes were required, But still I am getting this No CUDA GPUs are available error.

I have attached the screen shot of the error. Please help e figure out and resolve the problem.

I don’t know what exactly you’ve changed, but this code works for me without a GPU:

import torch

print(torch.cuda.is_available())

waveglow = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_waveglow', model_math='fp32')
waveglow = waveglow.remove_weightnorm(waveglow)
waveglow.eval()

tacotron2 = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_tacotron2', model_math='fp32')
tacotron2.eval()

text = "hello world, I missed you so much"
utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_tts_utils')
sequences, lengths = utils.prepare_input_sequence([text], cpu_run=True)

with torch.no_grad():
    mel, _, _ = tacotron2.infer(sequences, lengths)
    audio = waveglow.infer(mel)
audio_numpy = audio[0].data.cpu().numpy()
print(audio_numpy.shape)

after adding map_location='cpu' to the torch.load method in entrypoints.py for both models (since I wanted to use the pretrained models).

1 Like

Yeah, it worked for me too. Thanks!!