Skip to content

Commit

Permalink
Fix the weight_norm import issue (#195)
Browse files Browse the repository at this point in the history
Co-authored-by: 80268185 <[email protected]>
  • Loading branch information
starhaox and 80268185 authored Jan 17, 2024
1 parent c5ec709 commit 7e4820f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wetts/vits/model/decoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from torch.nn import Conv1d, ConvTranspose1d
from torch.nn import functional as F
from torch.nn.utils import remove_weight_norm
from torch.nn.utils.parametrizations import weight_norm
from torch.nn.utils import weight_norm
from torchaudio.transforms import InverseSpectrogram

from model.modules import LRELU_SLOPE
Expand Down
2 changes: 1 addition & 1 deletion wetts/vits/model/discriminators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from torch.nn import functional as F
from torch.nn import Conv1d, Conv2d
from torch.nn.utils import spectral_norm
from torch.nn.utils.parametrizations import weight_norm
from torch.nn.utils import weight_norm
from torchaudio.transforms import Spectrogram

from model.modules import LRELU_SLOPE
Expand Down
2 changes: 1 addition & 1 deletion wetts/vits/model/modules.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import torch
from torch import nn
from torch.nn.utils.parametrizations import weight_norm
from torch.nn.utils import weight_norm
from torch.nn.utils.parametrize import remove_parametrizations

from utils import commons
Expand Down

1 comment on commit 7e4820f

@Jackiexiao
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是又改回老 API 了吗 orz ...

https://pytorch.org/docs/stable/generated/torch.nn.utils.weight_norm.html

This function is deprecated. Use torch.nn.utils.parametrizations.weight_norm() which uses the modern parametrization API. The new weight_norm is compatible with state_dict generated from old weight_norm.

Please sign in to comment.