generated from fastai/nbdev_template
-
Notifications
You must be signed in to change notification settings - Fork 61
John istft - new vocoder #118
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
Open
johnpaulbin
wants to merge
15
commits into
master
Choose a base branch
from
john-istft
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6330b6c
new istft vocoder
johnpaulbin 2f7d72b
credit
johnpaulbin 438620a
fix device
johnpaulbin f6ac618
Update istftnet.py
johnpaulbin 52c682d
Update istftnet.py
johnpaulbin f933170
Update istftnet.py
johnpaulbin e1d83b7
Update istftnet.py
johnpaulbin 930dc7a
pls work
johnpaulbin 4bc5a65
Update istftnet.py
johnpaulbin c345aec
Update denoiser.py
johnpaulbin 53107b0
Update denoiser.py
johnpaulbin c9ac307
Update denoiser.py
johnpaulbin 4841567
Update denoiser.py
johnpaulbin c82068b
Update denoiser.py
johnpaulbin 5ebe30f
Update denoiser.py
johnpaulbin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
import sys | ||
import torch | ||
from ..models.common import STFT | ||
from ..vocoders.istftnet import iSTFTNetGenerator, TorchSTFT | ||
|
||
|
||
class Denoiser(torch.nn.Module): | ||
|
@@ -46,11 +47,21 @@ def __init__( | |
raise Exception("Mode {} if not supported".format(mode)) | ||
|
||
with torch.no_grad(): | ||
bias_audio = ( | ||
hifigan.vocoder.forward(mel_input.to(hifigan.device)) | ||
.view(1, -1) | ||
.float() | ||
) | ||
if isinstance(hifigan, iSTFTNetGenerator): | ||
self.stft = TorchSTFT(filter_length=16, hop_length=4, win_length=16, device="cpu").to("cpu") | ||
spec, phase = hifigan.vocoder(mel_input.to(hifigan.device)) | ||
y_g_hat = self.stft.inverse(spec.cpu(), phase.cpu()) | ||
bias_audio = ( | ||
y_g_hat | ||
.view(1, -1) | ||
.float() | ||
) | ||
else: | ||
bias_audio = ( | ||
hifigan.vocoder.forward(mel_input.to(hifigan.device)) | ||
.view(1, -1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
.float() | ||
) | ||
bias_spec, _ = self.stft.transform(bias_audio.cpu()) | ||
|
||
self.register_buffer("bias_spec", bias_spec[:, :, 0][:, :, None]) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try using rearrange from einops instead of view - its more verbose