mirror of
https://github.com/wassname/TTS.git
synced 2026-09-11 12:00:24 +08:00
Change config to json
This commit is contained in:
Binary file not shown.
+14
-1
@@ -4,9 +4,22 @@ import glob
|
||||
import time
|
||||
import shutil
|
||||
import datetime
|
||||
import json
|
||||
import numpy as np
|
||||
|
||||
|
||||
class AttrDict(dict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AttrDict, self).__init__(*args, **kwargs)
|
||||
self.__dict__ = self
|
||||
|
||||
|
||||
def load_config(config_path):
|
||||
config = AttrDict()
|
||||
config.update(json.load(open(config_path, "r")))
|
||||
return config
|
||||
|
||||
|
||||
def create_experiment_folder(root_path):
|
||||
""" Create a folder with the current date and time """
|
||||
date_str = datetime.datetime.now().strftime("%B-%d-%Y_%I:%M%p")
|
||||
@@ -20,7 +33,7 @@ def remove_experiment_folder(experiment_path):
|
||||
"""Check folder if there is a checkpoint, otherwise remove the folder"""
|
||||
|
||||
checkpoint_files = glob.glob(experiment_path+"/*.pth.tar")
|
||||
if len(checkpoint_files) == 0:
|
||||
if len(checkpoint_files) < 2:
|
||||
shutil.rmtree(experiment_path)
|
||||
print(" ! Run is removed from {}".format(experiment_path))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user