FENRlR / MB-iSTFT-VITS2

Application of MB-iSTFT-VITS components to vits2_pytorch
MIT License
118 stars 29 forks source link

AttributeError: 'ResidualCouplingTransformersLayer2' object has no attribute 'remove_weight_norm' #18

Closed Serdcoff closed 5 months ago

Serdcoff commented 8 months ago

Hi there, I have this error when I want to convert model weight to onnx model. How can I solve the problem?

Using mel posterior encoder for VITS2 Multi-band iSTFT VITS2 INFO:root:dec.stft.forward_basis is not in the checkpoint INFO:root:dec.stft.inverse_basis is not in the checkpoint INFO:root:Loaded checkpoint 'logs/models/G_48000.pth' (iteration 242) Removing weight norm... Traceback (most recent call last): File "onnx_export.py", line 79, in net_g.flow.remove_weight_norm() # Remove weightnorm in flows - a8d9f74 File "/MB-iSTFT-VITS2/models.py", line 759, in remove_weight_norm l.remove_weight_norm() File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1269, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'ResidualCouplingTransformersLayer2' object has no attribute 'remove_weight_norm'

Serdcoff commented 8 months ago

From my experience, I will add what I personally encountered. In requirements.txt you have row with pyopenjtalk==0.2.0. There was a problem for me on env witho building the wheel. I added pyopenjtalk==0.2.0 --no-build-isolation and everything was good. Also zoneinfo is required, but the supported version of python is >=3.9, but your app need 3.8. I had to change several files to "from backports.zoneinfo import zoneinfo" from "import zoneinfo"

Now I'm trying to run inference.ipynb to check the model but there was a problem with error

UPD. There was a problem with kernel. I fixed it, but another error is UPD 2: Everything worx! Just was a problem with cuda 0,1. Changed to 1 device and it worx! Thank you very much for support. Now I'm ready to train to another language and make a multi-lingual speaker.

Using mel posterior encoder for VITS2 Multi-band iSTFT VITS2


RuntimeError Traceback (most recent call last) Cell In[5], line 12 9 posterior_channels = hps.data.filter_length // 2 + 1 10 hps.data.use_mel_posterior_encoder = False ---> 12 net_g = SynthesizerTrn( 13 len(symbols), 14 posterior_channels, 15 hps.train.segment_size // hps.data.hop_length, 16 # n_speakers=hps.data.nspeakers, #- for multi speaker 17 **hps.model).to(device) 18 = netg.eval() 20 = utils.load_checkpoint(path_to_model, net_g, None)

File ~/.local/lib/python3.8/site-packages/torch/nn/modules/module.py:970, in Module.to(self, *args, kwargs) 883 def to(self, *args, *kwargs): 884 r"""Moves and/or casts the parameters and buffers. 885 886 This can be called as (...) 967 968 """ --> 970 device, dtype, non_blocking, convert_to_format = torch._C._nn._parse_to(args, kwargs) 972 if dtype is not None: 973 if not (dtype.is_floating_point or dtype.is_complex):

RuntimeError: Invalid device string: 'cuda:0,1'