GPT-SoVITS
GPT-SoVITS copied to clipboard
执行api.py报错
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
Traceback (most recent call last):
File "/Users/zefengsong/Documents/github/GPT-SoVITS/api.py", line 273, in
You need to turn it back to a dict. Change class DictToAttrRecursive to this:
class DictToAttrRecursive:
def __init__(self, input_dict):
for key, value in input_dict.items():
if isinstance(value, dict):
setattr(self, key, DictToAttrRecursive(value))
else:
setattr(self, key, value)
def to_dict(self):
output_dict = {}
for key in self.__dict__:
value = getattr(self, key)
if isinstance(value, DictToAttrRecursive):
output_dict[key] = value.to_dict()
else:
output_dict[key] = value
return output_dict
and use:
vq_model = SynthesizerTrn(
hps.data.filter_length // 2 + 1,
hps.train.segment_size // hps.data.hop_length,
n_speakers=hps.data.n_speakers,
**hps.model.to_dict()) # 调用 to_dict