From 4f500e8b4cabef64e6fdac5f82e868e4f0da704a Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Thu, 25 Dec 2025 02:07:49 +0000 Subject: [PATCH] write all data on training to training log --- pairwise_compare.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pairwise_compare.py b/pairwise_compare.py index 754cbd8..ba86a86 100755 --- a/pairwise_compare.py +++ b/pairwise_compare.py @@ -176,18 +176,17 @@ def training_entry(): loss_fn.backward() opt.step() - if step % TRAIN_PROGRESS == 0: - with torch.no_grad(): - pred = (torch.sigmoid(logits) > 0.5).float() - acc = (pred == y).float().mean().item() - tlog.write(f"step={step:5d} loss={loss_fn.item():.7f} acc={acc:.7f}\n") + with torch.no_grad(): + pred = (torch.sigmoid(logits) > 0.5).float() + acc = (pred == y).float().mean().item() + tlog.write(f"step={step:5d} loss={loss_fn.item():.7f} acc={acc:.7f}\n") - # also print to normal text log occasionally to show some activity. - # every 100 steps check if its been longer than 5 seconds since we've updated the user - if step % 100 == 0: - if (datetime.datetime.now() - last_ack).total_seconds() > 5: - log.info(f"still training... step={step} of {TRAIN_STEPS}") - last_ack = datetime.datetime.now() + # also print to normal text log occasionally to show some activity. + # every 100 steps check if its been longer than 5 seconds since we've updated the user + if step % 100 == 0: + if (datetime.datetime.now() - last_ack).total_seconds() > 5: + log.info(f"still training... step={step} of {TRAIN_STEPS}") + last_ack = datetime.datetime.now() training_end_time = datetime.datetime.now() log.info(f"Training steps complete. Start time: {training_start_time} End time: {training_end_time}")