Skip to content

Commit 118e20d

Browse files
committed
train: Fix saving best val loss weights
1 parent 949b1ee commit 118e20d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# 5. Train and evaluate
3535
log_loss = tqdm.tqdm(total=0, position=2, bar_format='{desc}', leave=False)
3636
prev_miou = 0.0
37-
prev_val_loss = 0.0
37+
prev_val_loss = 100
3838
for epoch in tqdm.tqdm(range(config[config['model']]['epoch']), desc='Epoch'):
3939
if utils.train_interupter():
4040
print('Train interrupt occurs.')
File renamed without changes.

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,13 @@ def __call__(self, image, target):
194194

195195

196196
def train_interupter():
197-
with open('train_interupter.txt', 'r', encoding='utf-8') as f:
197+
with open('train_interupter.ini', 'r', encoding='utf-8') as f:
198198
flag = f.read().strip()
199199

200200
if flag == '0':
201201
return False
202202
elif flag == '1':
203-
with open('train_interupter.txt', 'w', encoding='utf-8') as f:
203+
with open('train_interupter.ini', 'w', encoding='utf-8') as f:
204204
f.write('0')
205205
return True
206206
else:

0 commit comments

Comments
 (0)