INNER CODE UNIT · Python
get_models
netease-youdao/EmotiVoice · demo_page_databaker.py:69
def get_models():
am_checkpoint_path = scan_checkpoint(f'{config.output_directory}/ckpt', 'g_')
style_encoder_checkpoint_path = config.style_encoder_ckpt
with open(config.model_config_path, 'r') as fin:
conf = CONFIG.load_cfg(fin)
conf.n_vocab = config.n_symbols
conf.n_speaker = config.speaker_n_labels
style_encoder = StyleEncoder(config)
model_CKPT = torch.load(style_encoder_checkpoint_path, map_location="cpu")
model_ckpt = {}
for key, value in model_CKPT['model'].items():
new_key = key[7:]
model_ckpt[new_key] = value