From 80918f1f859cd4ce28c5c73938e74402c7db1488 Mon Sep 17 00:00:00 2001 From: kirianguiller Date: Mon, 3 Apr 2023 06:07:39 +0000 Subject: [PATCH] add: epoch info in each epoch json in history --- BertForDeprel/parser/cmds/train.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/BertForDeprel/parser/cmds/train.py b/BertForDeprel/parser/cmds/train.py index a1e2758..8bc4cd7 100755 --- a/BertForDeprel/parser/cmds/train.py +++ b/BertForDeprel/parser/cmds/train.py @@ -170,10 +170,10 @@ def __call__(self, args, model_params: ModelParams_T): results = model.eval_epoch(test_loader, args.device) results["n_sentences_train"] = len(train_dataset) results["n_sentences_test"] = len(test_dataset) + results["epoch"] = n_epoch_start - history = { - n_epoch_start: results, - } + history = [] + history.append(results) best_loss = results["loss_epoch"] best_LAS = results["LAS_epoch"] best_epoch_results = results @@ -185,7 +185,9 @@ def __call__(self, args, model_params: ModelParams_T): results = model.eval_epoch(test_loader, args.device) results["n_sentences_train"] = len(train_dataset) results["n_sentences_test"] = len(test_dataset) - history[n_epoch] = results + results["epoch"] = n_epoch + + history.append(results) with open(path_scores_history, "w") as outfile: outfile.write(json.dumps(history))