MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / __init__

Method __init__

vocoders/pwg.py:55–80  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

53@register_vocoder
54class PWG(BaseVocoder):
55 def __init__(self):
56 if hparams['vocoder_ckpt'] == '': # load LJSpeech PWG pretrained model
57 base_dir = 'wavegan_pretrained'
58 ckpts = glob.glob(f'{base_dir}/checkpoint-*steps.pkl')
59 ckpt = sorted(ckpts, key=
60 lambda x: int(re.findall(f'{base_dir}/checkpoint-(\d+)steps.pkl', x)[0]))[-1]
61 config_path = f'{base_dir}/config.yaml'
62 print('| load PWG: ', ckpt)
63 self.model, self.scaler, self.config, self.device = load_pwg_model(
64 config_path=config_path,
65 checkpoint_path=ckpt,
66 stats_path=f'{base_dir}/stats.h5',
67 )
68 else:
69 base_dir = hparams['vocoder_ckpt']
70 print(base_dir)
71 config_path = f'{base_dir}/config.yaml'
72 ckpt = sorted(glob.glob(f'{base_dir}/model_ckpt_steps_*.ckpt'), key=
73 lambda x: int(re.findall(f'{base_dir}/model_ckpt_steps_(\d+).ckpt', x)[0]))[-1]
74 print('| load PWG: ', ckpt)
75 self.scaler = None
76 self.model, _, self.config, self.device = load_pwg_model(
77 config_path=config_path,
78 checkpoint_path=ckpt,
79 stats_path=f'{base_dir}/stats.h5',
80 )
81
82 def spec2wav(self, mel, **kwargs):
83 # start generation

Callers

nothing calls this directly

Calls 1

load_pwg_modelFunction · 0.85

Tested by

no test coverage detected