Skip to content

Commit

Permalink
add: epoch info in each epoch json in history
Browse files Browse the repository at this point in the history
  • Loading branch information
kirianguiller committed Apr 3, 2023
1 parent c9ba2a4 commit 80918f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions BertForDeprel/parser/cmds/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))

Expand Down

0 comments on commit 80918f1

Please sign in to comment.