netease-youdao / EmotiVoice

EmotiVoice 😊: a Multi-Voice and Prompt-Controlled TTS Engine
Apache License 2.0
7.34k stars 628 forks source link

win显示编码错误 #2

Closed ashuoAI closed 11 months ago

ashuoAI commented 11 months ago

UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 2: illegal multibyte sequence

微信图片_20231111025222
syq163 commented 11 months ago

Thank you for reporting this issue. We will try to reproduce it as soon as possible.

Air3Snow commented 11 months ago

windows报错,改一下文件读取编码格式就行 `

Emotion

with open(emotion2id_path,encoding="utf-8") as f:
    emotions = [t.strip() for t in f.readlines()]
emotion_n_labels = len(emotions)

#### Speed ####
with open(speed2id_path,encoding="utf-8") as f:
    speeds = [t.strip() for t in f.readlines()]
speed_n_labels = len(speeds)

#### Pitch ####
with open(pitch2id_path,encoding="utf-8") as f:
    pitchs = [t.strip() for t in f.readlines()]
pitch_n_labels = len(pitchs)

#### Energy ####
with open(energy2id_path,encoding="utf-8") as f:
    energys = [t.strip() for t in f.readlines()]
energy_n_labels = len(energys)

`

syq163 commented 11 months ago

windows报错,改一下文件读取编码格式就行 ` #### Emotion #### with open(emotion2id_path,encoding="utf-8") as f: emotions = [t.strip() for t in f.readlines()] emotion_n_labels = len(emotions)

#### Speed ####
with open(speed2id_path,encoding="utf-8") as f:
    speeds = [t.strip() for t in f.readlines()]
speed_n_labels = len(speeds)

#### Pitch ####
with open(pitch2id_path,encoding="utf-8") as f:
    pitchs = [t.strip() for t in f.readlines()]
pitch_n_labels = len(pitchs)

#### Energy ####
with open(energy2id_path,encoding="utf-8") as f:
    energys = [t.strip() for t in f.readlines()]
energy_n_labels = len(energys)

` @Air3Snow thank you for your assistance! @q88622406 , you can try this to see if it resolves the issue.

makao007 commented 11 months ago

Yes, I also found this error. I just try below.

    emotions = open(emotion2id_path, encoding='utf-8').read().split('\n')

    speeds = open(speed2id_path, encoding='utf-8').read().split('\n')

    pitchs = open(pitch2id_path, encoding='utf-8').read().split('\n')
lucasjinreal commented 11 months ago

@makao007 the pretrained model can not be load:

EmotiVoice/inference_am_vocoder_joint.py", line 67, 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".

ashuoAI commented 11 months ago

@makao007 the pretrained model can not be load:

EmotiVoice/inference_am_vocoder_joint.py", line 67, 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".

Yes, I have solved the above problem. I am currently encountering the same problem as you, which is a model error

lucasjinreal commented 11 months ago

@q88622406 Using old transformers lib is not the right solution, we should force official author support latest transformers, the lib breaks all other toolchains.

shirubei commented 11 months ago

inference_am_vocoder_joint.py 中也有一个地方要加个encoding

with open(text_path, "r", encoding="UTF-8") as f:

fengcheche commented 11 months ago

@shirubei @makao007 我也遇到这个问题了,改了不起作用呢

fengcheche commented 11 months ago

可以了