From e3c052382bd76dcd1184fdd33c5e8932aea793e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Thu, 1 Apr 2021 03:41:15 +0200 Subject: [PATCH] fix loading always best_model when continue --- TTS/utils/arguments.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TTS/utils/arguments.py b/TTS/utils/arguments.py index 6a4c3da5..053993ca 100644 --- a/TTS/utils/arguments.py +++ b/TTS/utils/arguments.py @@ -7,6 +7,7 @@ import glob import os import re +import torch from TTS.tts.utils.text.symbols import parse_symbols from TTS.utils.console_logger import ConsoleLogger from TTS.utils.generic_utils import create_experiment_folder, get_git_branch @@ -103,7 +104,7 @@ def get_last_checkpoint(path): key_file_names = [fn for fn in file_names if key in fn] if last_model is None and len(key_file_names) > 0: last_model = max(key_file_names, key=os.path.getctime) - last_model_num = os.path.getctime(last_model) + last_model_num = torch.load(last_model)['step'] if last_model is not None: last_models[key] = last_model