multi-speaker-tacotron-tens.../models/__init__.py

18 lines
577 B
Python
Raw Normal View History

2017-10-15 16:00:17 +02:00
import os
from glob import glob
from .tacotron import Tacotron
def create_model(hparams):
return Tacotron(hparams)
def get_most_recent_checkpoint(checkpoint_dir):
checkpoint_paths = [path for path in glob("{}/*.ckpt-*.data-*".format(checkpoint_dir))]
idxes = [int(os.path.basename(path).split('-')[1].split('.')[0]) for path in checkpoint_paths]
max_idx = max(idxes)
lastest_checkpoint = os.path.join(checkpoint_dir, "model.ckpt-{}".format(max_idx))
print(" [*] Found lastest checkpoint: {}".format(lastest_checkpoint))
return lastest_checkpoint