Plachtaa / VITS-fast-fine-tuning

This repo is a pipeline of VITS finetuning for fast speaker adaptation TTS, and many-to-many voice conversion
Apache License 2.0
4.69k stars 703 forks source link

python VC_inference.py --model_dir ./OUTPUT_MODEL/G_latest.pth --share True 报错 'list' object has no attribute 'keys' #524

Open jiangsiYang opened 9 months ago

jiangsiYang commented 9 months ago

我第一次用C的模型训练,但{PRETRAINED_MODEL}都用了CJ,所以出现这个报错; 令我疑惑的是,我后面重新下载CJ模型,放在对应的目录,使用对应的finetune_speaker.json,重新从"Process all audio data."这一步开始跑,还是在python VC_inference.py --model_dir ./OUTPUT_MODEL/G_latest.pth --share True 执行时报错: DEBUG:urllib3.connectionpool:https://api.gradio.app:443 "GET /gradio-messaging/en HTTP/1.1" 200 3 INFO:root:Loaded checkpoint './OUTPUT_MODEL/G_latest.pth' (iteration 2) Traceback (most recent call last): File "VC_inference.py", line 106, in speakers = list(hps.speakers.keys()) AttributeError: 'list' object has no attribute 'keys' 重复了几次重新下载CJ model,再跑,还是这样,是不是哪里有缓存这一说导致我更换CJ还是无效的呢?求助!感谢!

Lu233 commented 9 months ago

同样的问题,请问解决了吗,解决方法是什么,谢谢

pifeifei commented 9 months ago

同问题 + 1

也是这一步报错

ihmily commented 9 months ago

可能是你选择的配置文件不对,需要指定config文件路径,正确的配置文件应该是OUTPUT_MODEL目录下的config.json文件或者是configs文件夹下的modified_finetune_speaker.json文件。

使用下面的命令运行

python VC_inference.py --model_dir ./OUTPUT_MODEL/G_latest.pth  --config_dir ./OUTPUT_MODEL/config.json  --share True
xw2018 commented 8 months ago

作者给的CJE的配置文件中speakers为字典,CJ和C的配置文件speaker都是列表。我尝试把CJE的字典直接复制过来会报错。最后是在VC_inference.py的主函数开头把列表手动转了字典,暂时能跑了,不知道后面有没有问题,仅供参考:

_ = utils.load_checkpoint(args.model_dir, net_g, None)

CJE

# speaker_ids = hps.speakers

CJ

speaker_ids = hps.speakers if(type(speaker_ids)==list): index=[i for i in range(len(speaker_ids))] speaker_ids=dict(zip(hps.speakers,index)) hps.speakers=speaker_ids speakers = list(hps.speakers.keys())