EmotiVoice icon indicating copy to clipboard operation
EmotiVoice copied to clipboard

EmotiVoice/inference_am_vocoder_joint.py", line 66, in main style_encoder.load_state_dict(model_ckpt) File "/root/anaconda3/lib/python3.9/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 StyleEncoder: Unexpected key(s) in state_dict: "bert.embeddings.position_ids".

Open lucasjinreal opened this issue 1 year ago • 7 comments

EmotiVoice/inference_am_vocoder_joint.py", line 66, in main style_encoder.load_state_dict(model_ckpt) File "/root/anaconda3/lib/python3.9/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 StyleEncoder: Unexpected key(s) in state_dict: "bert.embeddings.position_ids".

lucasjinreal avatar Nov 13 '23 11:11 lucasjinreal

Win11, the same question

ashuoAI avatar Nov 13 '23 16:11 ashuoAI

install transformers==4.26.1

ninerui avatar Nov 14 '23 01:11 ninerui

。。。。。。 the lastest comes to 4.35 now........ Why strictly the transformers lib rather than make it compatible latest? I am so confused

lucasjinreal avatar Nov 14 '23 02:11 lucasjinreal

You strict requirements will break all users' other toolchains. Even though you can say use virtual env is your choice but why should we waste time to create a new env??

lucasjinreal avatar Nov 14 '23 02:11 lucasjinreal

@syq163 Why do u close this issue? Many users might come to this error and didn't notice exactly reason of this.

lucasjinreal avatar Nov 14 '23 02:11 lucasjinreal

for latest transformer

if new_key == 'bert.embeddings.position_ids':
    new_key = 'bert.embeddings.position_embeddings'
model_ckpt[new_key] = value

huangxu1991 avatar Dec 06 '23 12:12 huangxu1991

Thank you for your assistance. The latest code has attempted to resolve the dependency issue with 'transformers==4.26.1'. You are encouraged to update and check if the problem has been resolved.

syq163 avatar Dec 07 '23 08:12 syq163