Problem and solution to .wav saving - object has no attribute 'kind'
#1
by
the-french-artist
- opened
This line:
scipy.io.wavfile.write("techno.wav", rate=model.config.sampling_rate, data=output)
Causes this error:
AttributeError: 'torch.dtype' object has no attribute 'kind'
Solution:
After:
output = output.cpu()
Add this :
import scipy.io.wavfile
import numpy as np
data_np = output.numpy()
data_np_squeezed = np.squeeze(data_np)
scipy.io.wavfile.write("output.wav", rate=model.config.sampling_rate, data=data_np_squeezed)