babysor / MockingBird

🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time
Other
34.89k stars 5.18k forks source link

用这里的模型跑出现这个RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([70, 512]) from checkpoint, the shape in current model is torch.Size([75, 512]). #37

Closed wangkewk closed 3 years ago

JerryKingQAQ commented 2 years ago

请问如何切换版本?

LiangDazhu commented 2 years ago
image
cxgreat2014 commented 2 years ago

Same issue

cxgreat2014 commented 2 years ago

改完一样报错,看起来又有新的问题,,,,,,,,,

Htt-Qcty commented 2 years ago

File "E:\语音克隆\MockingBird\synthesizer\models\tacotron.py", line 564, in load self.load_state_dict(checkpoint["model_state"], strict=False) File "E:\anaconda\envs\torch\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Tacotron2: size mismatch for embedding.weight: copying a param with shape torch.Size([148, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]).

Htt-Qcty commented 2 years ago

怎么解决呀,我改了之后后面的70变化了

Htt-Qcty commented 2 years ago

帮帮孩子吧

Htt-Qcty commented 2 years ago

我这个是拿nVidia那个改了一点,为什么前面是148,怎么修改这个值

zhuhero2012 commented 1 year ago

这个是我最近一个修复导致的不兼容问题, 你可以把文件中:synthesizer/utils/symbols.py 第11行的内容 改为: _characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz12340!\'(),-.:;? ' 即可。暂时先不要关闭这个issue吧。我看下遇到的人太多的话我做个兼容

改了 没用啊

zhuhero2012 commented 1 year ago

已修改,还是出现报错synthesizer/utils/symbols.py

Synthesizer using device: cuda
Trainable Parameters: 32.735M
Traceback (most recent call last):
  File "D:\AI\sv2tts_china\MockingBird\toolbox\__init__.py", line 123, in <lambda>
    func = lambda: self.synthesize() or self.vocode()
  File "D:\AI\sv2tts_china\MockingBird\toolbox\__init__.py", line 238, in synthesize
    specs = self.synthesizer.synthesize_spectrograms(texts, embeds, style_idx=int(self.ui.style_slider.value()), min_stop_token=min_token)
  File "D:\AI\sv2tts_china\MockingBird\synthesizer\inference.py", line 87, in synthesize_spectrograms
    self.load()
  File "D:\AI\sv2tts_china\MockingBird\synthesizer\inference.py", line 65, in load
    self._model.load(self.model_fpath)
  File "D:\AI\sv2tts_china\MockingBird\synthesizer\models\tacotron.py", line 525, in load
    self.load_state_dict(checkpoint["model_state"], strict=False)
  File "D:\ProgramData\Anaconda3\envs\Real-Time-Voice-Cloning\lib\site-packages\torch\nn\modules\module.py", line 1483, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Tacotron:
        size mismatch for encoder_proj.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([128, 1024]).
        size mismatch for decoder.attn_rnn.weight_ih: copying a param with shape torch.Size([384, 768]) from checkpoint, the shape in current model is torch.Size([384, 1280]).
        size mismatch for decoder.rnn_input.weight: copying a param with shape torch.Size([1024, 640]) from checkpoint, the shape in current model is torch.Size([1024, 1152]).
        size mismatch for decoder.stop_proj.weight: copying a param with shape torch.Size([1, 1536]) from checkpoint, the shape in current model is torch.Size([1, 2048]).

同样的报错 你那个好了吗?

同样的报错 你那个好了吗?

zhaowei0315 commented 1 year ago

同样的报错 你那个好了吗?

同样的报错 你那个好了吗?

XZirui commented 1 year ago

同问 切换到v0.0.1依然不行 (已加修复) pytorch是最新版 cuda11.7

magicnight commented 1 year ago

按说明修改后还是没用,一样报错。一定要自己训练吗?

MichaelToLearn commented 1 year ago

这个是我最近一个修复导致的不兼容问题, 你可以把文件中:synthesizer/utils/symbols.py 第11行的内容 改为: _characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz12340!\'(),-.:;? ' 即可。暂时先不要关闭这个issue吧。我看下遇到的人太多的话我做个兼容

快两年了,这个还会兼容吗 。。

zzllabcd commented 1 year ago

RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]). Traceback: File "D:\ProgramData\Anaconda3\envs\voiceClone\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script exec(code, module.dict) File "C:\Users\zhanglong\AppData\Local\Temp\tmp342r_iv9.py", line 13, in render_streamlit_ui() File "H:\MockingBird\MockingBird\control\mkgui\base\ui\streamlit_ui.py", line 909, in render_streamlit_ui session_state.output_data = opyrator(input=input_data_obj) File "H:\MockingBird\MockingBird\control\mkgui\base\core.py", line 203, in call return self.function(input_obj, **kwargs) File "H:\MockingBird\MockingBird\control\mkgui\app.py", line 140, in synthesize specs = current_synt.synthesize_spectrograms(texts, embeds) File "H:\MockingBird\MockingBird\models\synthesizer\inference.py", line 91, in synthesize_spectrograms self.load() File "H:\MockingBird\MockingBird\models\synthesizer\inference.py", line 69, in load self._model.load(self.model_fpath, self.device) File "H:\MockingBird\MockingBird\models\synthesizer\models\base.py", line 55, in load self.load_state_dict(state, strict=False) File "D:\ProgramData\Anaconda3\envs\voiceClone\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(

ShineDreamCatcher commented 1 year ago

Traceback (most recent call last): File "D:\codeinstall\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 552, in _run_script exec(code, module.dict) File "C:\Users\zy820\AppData\Local\Temp\tmpegto92vs.py", line 13, in render_streamlit_ui() File "D:\develop\workspace-project\MockingBird\control\mkgui\base\ui\streamlit_ui.py", line 909, in render_streamlit_ui session_state.output_data = opyrator(input=input_data_obj) File "D:\develop\workspace-project\MockingBird\control\mkgui\base\core.py", line 203, in call return self.function(input_obj, **kwargs) self._model.load(self.model_fpath, self.device) File "D:\develop\workspace-project\MockingBird\models\synthesizer\models\base.py", line 55, in load self.load_state_dict(state, strict=False) File "D:\codeinstall\Python310\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).

按照上面的解决方法改了还是报错,有新的解决方案没

chuck816 commented 1 year ago

Traceback (most recent call last): File "G:\PycharmProjects\MockingBird\control\toolbox__init__.py", line 260, in synthesize specs = self.synthesizer.synthesize_spectrograms(texts, embeds, style_idx=int(self.ui.style_slider.value()), min_stop_token=min_token, steps=int(self.ui.length_slider.value())*200) File "G:\PycharmProjects\MockingBird\models\synthesizer\inference.py", line 91, in synthesize_spectrograms self.load() File "G:\PycharmProjects\MockingBird\models\synthesizer\inference.py", line 69, in load self._model.load(self.model_fpath, self.device) File "G:\PycharmProjects\MockingBird\models\synthesizer\models\base.py", line 55, in load self.load_state_dict(state, strict=False) File "C:\Users\Admin.conda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([70, 512]) from checkpoint, the shape in current model is torch.Size([75, 512]). size mismatch for encoder_proj.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([128, 1024]). size mismatch for decoder.attn_rnn.weight_ih: copying a param with shape torch.Size([384, 768]) from checkpoint, the shape in current model is torch.Size([384, 1280]). size mismatch for decoder.rnn_input.weight: copying a param with shape torch.Size([1024, 640]) from checkpoint, the shape in current model is torch.Size([1024, 1152]). size mismatch for decoder.stop_proj.weight: copying a param with shape torch.Size([1, 1536]) from checkpoint, the shape in current model is torch.Size([1, 2048]). QWindowsWindow::setGeometry: Unable to set geometry 1992x1001+0+29 (frame: 2010x1048-9-9) on QWidgetWindow/"UIClassWindow" on "\.\DISPLAY1". Resulting geometry: 1920x1001+0+29 (frame: 1938x1048-9-9) margins: 9, 38, 9, 9 minimum size: 1992x583 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=2010,630 maxtrack=0,0)

你好,除了一个75k steps 的合成器正常运行了,25k 150k 200k 的均出现类似的错误,这个是加载mandarin_200k.pt的合成器时候的报错,到现在还有解决方案吗?谢谢

chuck816 commented 1 year ago

上面提供改的所有方案都试过了全部没用,不知道真正导致数据不同步的错误在运行环境哪里

hu1991die commented 1 year ago

这个是我最近一个修复导致的不兼容问题, 你可以把文件中:synthesizer/utils/symbols.py 第11行的symbols 改为: _characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz12340!\'(),-.:;? ' 即可。暂时先不要关闭这个issue吧。我看下遇到的人太多的话我做个兼容

感谢!问题已顺利解决。

RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]). Traceback: File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 552, in _run_script exec(code, module.dict) File "C:\Users\Admin\AppData\Local\Temp\tmpsj6156uv.py", line 13, in render_streamlit_ui() File "E:\GithubProjects\MockingBird-main\control\mkgui\base\ui\streamlit_ui.py", line 909, in render_streamlit_ui session_state.output_data = opyrator(input=input_data_obj) File "E:\GithubProjects\MockingBird-main\control\mkgui\base\core.py", line 203, in call return self.function(input_obj, **kwargs) File "E:\GithubProjects\MockingBird-main\control\mkgui\app.py", line 140, in synthesize specs = current_synt.synthesize_spectrograms(texts, embeds) File "E:\GithubProjects\MockingBird-main\models\synthesizer\inference.py", line 91, in synthesize_spectrograms self.load() File "E:\GithubProjects\MockingBird-main\models\synthesizer\inference.py", line 69, in load self._model.load(self.model_fpath, self.device) File "E:\GithubProjects\MockingBird-main\models\synthesizer\models\base.py", line 55, in load self.load_state_dict(state, strict=False) File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(

按照这个修改了MockingBird-main\models\synthesizer\utils目录下面的symbols.py文件里面的第11行代码,但是依旧还是报错,不知道什么原因?

danyow-cheung commented 11 months ago

在我实际使用中发现,如果出现尺寸不匹配的问题,有说是输入框文字切割的问题,原始仓库Real-Time-Voice-Cloning也会出现这个问题。 但是多点击几次好像就不报这个错误,但是输出的音频还是以杂音为主

Centralcosmic commented 9 months ago

这个是我最近一个修复导致的不兼容问题, 你可以把文件中:synthesizer/utils/symbols.py 第11行的symbols 改为: _characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz12340!\'(),-.:;? ' 即可。暂时先不要关闭这个issue吧。我看下遇到的人太多的话我做个兼容

感谢!问题已顺利解决。

RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]). Traceback: File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 552, in _run_script exec(code, module.dict) File "C:\Users\Admin\AppData\Local\Temp\tmpsj6156uv.py", line 13, in render_streamlit_ui() File "E:\GithubProjects\MockingBird-main\control\mkgui\base\ui\streamlit_ui.py", line 909, in render_streamlit_ui session_state.output_data = opyrator(input=input_data_obj) File "E:\GithubProjects\MockingBird-main\control\mkgui\base\core.py", line 203, in call return self.function(input_obj, **kwargs) File "E:\GithubProjects\MockingBird-main\control\mkgui\app.py", line 140, in synthesize specs = current_synt.synthesize_spectrograms(texts, embeds) File "E:\GithubProjects\MockingBird-main\models\synthesizer\inference.py", line 91, in synthesize_spectrograms self.load() File "E:\GithubProjects\MockingBird-main\models\synthesizer\inference.py", line 69, in load self._model.load(self.model_fpath, self.device) File "E:\GithubProjects\MockingBird-main\models\synthesizer\models\base.py", line 55, in load self.load_state_dict(state, strict=False) File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(

按照这个修改了MockingBird-main\models\synthesizer\utils目录下面的symbols.py文件里面的第11行代码,但是依旧还是报错,不知道什么原因?

同 不知道解决了吗

SpaceRexxx commented 7 months ago

修改后还是报错: RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]). Traceback: File "/Users/ywy/Library/Python/3.11/lib/python/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script exec(code, module.dict) File "/private/var/folders/53/3r03mt7d4v9bsvhljvnd_zs80000gn/T/tmpo53ek00n.py", line 13, in render_streamlit_ui() File "/Users/ywy/MockingBird/control/mkgui/base/ui/streamlit_ui.py", line 909, in render_streamlit_ui session_state.output_data = opyrator(input=input_data_obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ywy/MockingBird/control/mkgui/base/core.py", line 203, in call return self.function(input_obj, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ywy/MockingBird/control/mkgui/app.py", line 140, in synthesize specs = current_synt.synthesize_spectrograms(texts, embeds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ywy/MockingBird/models/synthesizer/inference.py", line 91, in synthesize_spectrograms self.load() File "/Users/ywy/MockingBird/models/synthesizer/inference.py", line 69, in load self._model.load(self.model_fpath, self.device) File "/Users/ywy/MockingBird/models/synthesizer/models/base.py", line 55, in load self.load_state_dict(state, strict=False) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(

1944926512 commented 7 months ago

Traceback (most recent call last): File "D:\python\tts\chatgpt\tts\MockingBird-main\control\toolbox__init.py", line 144, in func = lambda: self.synthesize() or self.vocode() ^^^^^^^^^^^^^^^^^ File "D:\python\tts\chatgpt\tts\MockingBird-main\control\toolbox\init__.py", line 260, in synthesize specs = self.synthesizer.synthesize_spectrograms(texts, embeds, style_idx=int(self.ui.style_slider.value()), min_stop_token=min_token, steps=int(self.ui.length_slider.value())*200) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\python\tts\chatgpt\tts\MockingBird-main\models\synthesizer\inference.py", line 91, in synthesize_spectrograms self.load() File "D:\python\tts\chatgpt\tts\MockingBird-main\models\synthesizer\inference.py", line 69, in load self._model.load(self.model_fpath, self.device) File "D:\python\tts\chatgpt\tts\MockingBird-main\models\synthesizer\models\base.py", line 55, in load self.load_state_dict(state, strict=False) File "C:\ProgramData\anaconda3\envs\pytorch\Lib\site-packages\torch\nn\modules\module.py", line 2152, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).

kushr11 commented 2 months ago

同修改后还是报错 RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).

Eouning commented 1 month ago

同修改后还是报错 RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder.embedding.weight: copying a param with shape torch.Size([75, 512]) from checkpoint, the shape in current model is torch.Size([70, 512]). size mismatch for gst.stl.attention.W_query.weight: copying a param with shape torch.Size([512, 256]) from checkpoint, the shape in current model is torch.Size([512, 512]).

JangGouDan commented 1 week ago

RuntimeError: Error(s) in loading state_dict for Tacotron: size mismatch for encoder_proj.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([128, 1024]). size mismatch for decoder.attn_rnn.weight_ih: copying a param with shape torch.Size([384, 768]) from checkpoint, the shape in current model is torch.Size([384, 1280]). size mismatch for decoder.rnn_input.weight: copying a param with shape torch.Size([1024, 640]) from checkpoint, the shape in current model is torch.Size([1024, 1152]). size mismatch for decoder.stop_proj.weight: copying a param with shape torch.Size([1, 1536]) from checkpoint, the shape in current model is torch.Size([1, 2048]). 相同问题