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

Is it possible to load .npy spectrograms directly? #4

Closed
george-roussos opened this issue Sep 24, 2020 · 3 comments
Closed

Is it possible to load .npy spectrograms directly? #4

george-roussos opened this issue Sep 24, 2020 · 3 comments
Labels
question Further information is requested

Comments

@george-roussos
Copy link

Hi, on the notebook it isn't clear whether you can load your own spectrogram directly (for TTS inference) or not. Is this possible and if so, have you tried it?

@ivanvovk
Copy link
Owner

ivanvovk commented Sep 24, 2020

Do you mean by "your own spectrogram" a mel-spectrogram from another speaker? Trained WaveGrad can take any mel-spectrogram as input: it should be of type 'torch.Tensor' and it should match STFT parameters, which were used to train WaveGrad. Generally, the output quality can depend on a speaker you are trying to feed the model with. I haven't tested WaveGrad on unseen speakers, but I believe it should perform well.

@ivanvovk ivanvovk added the question Further information is requested label Sep 24, 2020
@george-roussos
Copy link
Author

george-roussos commented Sep 24, 2020

Thanks! No, I meant feeding WaveGrad a .npy of a TTS trained on the same speaker, instead of running inference on the test set, because I didn't see it anywhere on the notebook (or I just missed it). I guess I pass it as a mel instead of iterating over a batch?

@ivanvovk
Copy link
Owner

Yeah, if you have your mel of type np.array saved on a disk, than just load it and convert it into torch.Tensor. For conversion you can use classical torch.from_numpy(your_numpy_mel) or just torch.FloatTensor(your_numpy_mel). Finally, make sure that your mel has batch dimension, e.g. 1 x n_mels x n_frames and is on the same device as WaveGrad (CPU or GPU). Then, you can feed it as input to the forward method.

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