in train.py [0:0]
def __init__(self, path, resume):
if not resume and os.path.exists(path):
print(path + " exists")
sys.exit(0)
iternum = 0
if resume:
with open(path, "r") as f:
for line in f.readlines():
match = re.search("Iteration (\d+).* ", line)
if match is not None:
it = int(match.group(1))
if it > iternum:
iternum = it
self.iternum = iternum
self.log = open(path, "a") if resume else open(path, "w")
self.stdout = sys.stdout
sys.stdout = self