Skip to content

Commit 00213ed

Browse files
committed
changed the order of saving the model and the weights so that training can be terminated early
1 parent 67ea72c commit 00213ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/train.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def train(args):
7878
checkpoint = ModelCheckpoint(checkpoint_filepath, monitor='val_loss',
7979
verbose=1, save_best_only=True)
8080
callbacks_list = [checkpoint]
81-
82-
model.fit(x_train, y_train, validation_data=(x_val, y_val),
83-
nb_epoch=args.num_epochs, batch_size=args.batch_size, callbacks=callbacks_list)
8481
model_json = model.to_json()
8582
with open(os.path.join(args.model_dir, "model.json"), "w") as json_file:
8683
json_file.write(model_json)
8784

85+
model.fit(x_train, y_train, validation_data=(x_val, y_val),
86+
nb_epoch=args.num_epochs, batch_size=args.batch_size, callbacks=callbacks_list)
87+
8888

8989
if __name__ == '__main__':
9090
main()

0 commit comments

Comments
 (0)