Closed Baiyuetribe closed 2 years ago
Yes, if you have a CUDA-enabled GPU, you can enable it by loading the model and data onto the GPU before running inference.
model = models.BandwidthExtender.from_pretrained(args.model).cuda()
audio = np.stack([model(torch.from_numpy(x).cuda(), sample_rate).cpu() for x in audio.T]).T
This would also be a useful feature to have in the library, so I'll look into adding it to the script.
This has been released in version 0.1.13 of the library. You can modify your command above as follows to run synthesis on a CUDA-capable GPU:
hifi-synth --device=cuda hifi-gan-bwe-10-42890e3-vctk-48kHz input.mp3 output.wav
Please reopen the issue if you run into any problems with this change.
cuda takes effect, but the gpu memory overflows. The source file audio is only 4M.
Also I can't reopen the issue, you seem to have disabled it
Ah yes, an 11MB MP3 file would be quite a bit of audio, which explains the OOM on the GPU. It would be nice if the synth script would break up the audio into segments, process them, and then reassemble the resulting audio. If I get some time this week, I'll add that to the script.
I added streaming/cross-fading support in the hifi-synth
script to version 0.1.14 of the library. By default, the script will window the signal into 30sec frames with 25ms cross-fading overlap, but these can be customized when you call the script. Thanks again for the report, and I hope this helps.
Can I enable GPU acceleration if the running memory and CPU consumption are too much?