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

KeyError: '__getstate__' #69

Open
mingri-lt opened this issue Oct 6, 2022 · 1 comment
Open

KeyError: '__getstate__' #69

mingri-lt opened this issue Oct 6, 2022 · 1 comment

Comments

@mingri-lt
Copy link

mingri-lt commented Oct 6, 2022

When I tried to train my own model, I ran into this error

Traceback (most recent call last):
  File "E:\VocieData\tacotron2\melgan-0.3-alpha\utils\train.py", line 60, in train
    validate(hp, args, model_g, model_d, valloader, writer, step)
  File "E:\VocieData\tacotron2\melgan-0.3-alpha\utils\validation.py", line 13, in validate
    for mel, audio in loader:
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\tqdm\std.py", line 1195, in __iter__
    for obj in iterable:
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\utils\data\dataloader.py", line 359, in __iter__
    return self._get_iterator()
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\utils\data\dataloader.py", line 918, in __init__
    w.start()
  File "D:\Software\Anaconda3\envs\melgan\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "D:\Software\Anaconda3\envs\melgan\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "D:\Software\Anaconda3\envs\melgan\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "D:\Software\Anaconda3\envs\melgan\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)
  File "D:\Software\Anaconda3\envs\melgan\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
KeyError: '__getstate__'

Then I made a few changes:
loader = tqdm.tqdm(valloader, desc='Validation loop')
loader = tqdm.tqdm(valloader.dataset, desc='Validation loop')

and then:

Validation loop:   0%|                                                                                  | 0/1000 [00:02<?, ?it/s]
2022-10-06 09:59:39,152 - INFO - Exiting due to exception: Expected 3-dimensional input for 3-dimensional weight [512, 80, 7], but got 2-dimensional input of size [80, 173] instead
Traceback (most recent call last):
  File "E:\VocieData\tacotron2\melgan-0.3-alpha\utils\train.py", line 60, in train
    validate(hp, args, model_g, model_d, valloader, writer, step)
  File "E:\VocieData\tacotron2\melgan-0.3-alpha\utils\validation.py", line 18, in validate
    fake_audio = generator(mel)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "E:\VocieData\tacotron2\melgan-0.3-alpha\model\generator.py", line 48, in forward
    return self.generator(mel)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\nn\modules\container.py", line 141, in forward
    input = module(input)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\nn\modules\module.py", line 1120, in _call_impl
    result = forward_call(*input, **kwargs)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\nn\modules\conv.py", line 301, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "D:\Software\Anaconda3\envs\melgan\lib\site-packages\torch\nn\modules\conv.py", line 298, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Expected 3-dimensional input for 3-dimensional weight [512, 80, 7], but got 2-dimensional input of size [80, 173] instead

How do I fix it please?

@mingri-lt
Copy link
Author

I have fix this problem and use biaobei tts dataset to train success.

I have made some changes to the code in order to smooth out the training.

in validation.py :

def validate(hp, args, generator, discriminator, valloader, writer, step):
    ... ...
    loader = tqdm.tqdm(valloader.dataset, desc='Validation loop')
    ... ...
    
    
    for mel, audio in loader:
        mel = mel.reshape(1, mel.size(0), mel.size(1))
        audio = audio.reshape(1, 1, audio.size(1))
        ... ...

in train.py :

            ... ...
            loader = tqdm.tqdm(trainloader.dataset, desc='Loading train data')
            
            for (melG, audioG), (melD, audioD) in loader:
                ... ...
                melG = melG.reshape(1, melG.size(0), melG.size(1))
                audioG = audioG.reshape(1, audioG.size(0), audioG.size(1))
                melD = melD.reshape(1, melD.size(0), melD.size(1))
                audioD = audioD.reshape(1, audioD.size(0), audioD.size(1))
                ... ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant