question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No Callbacks for Validation Batch Step - How To Get Progress of Validation?

See original GitHub issue

🚀 Feature

The Callbacks has two functions on_batch_start and on_batch_end. The documentation and code execution shows that these are only called for training batches, not validaton (or test). I am building a Callback for my own logging/dashboarding via Streamlit and I have a requirement to track the progress of both the train batch steps and validation batch steps during training. I see that there is a validation progress bar in the console during training - how is this implemented (if not via a Callback)?

Current Code

class MyCallback(pl.Callback):
    def on_train_start(self, trainer, pl_module):
        self.train_batch_count = 0
        self.train_batch_total = len(trainer.train_dataloader)

    def on_batch_end(self, train, pl_module):
        self.train_batch_count += 1
        percent_complete = self.train_batch_count / self.train_batch_total
        # display on screen

    def on_epoch_end(self, train, pl_module):
        self.train_batch_count = 0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
awaelchlicommented, Apr 24, 2020

In case this is still relevant to you, we now also have callbacks for validatation and test batches! See https://pytorch-lightning.readthedocs.io/en/latest/callbacks.html#callback-base

Read more comments on GitHub >

github_iconTop Results From Across the Web

No Callbacks for Validation Batch Step - How To Get Progress ...
I am building a Callback for my own logging/dashboarding via Streamlit and I have a requirement to track the progress of both the...
Read more >
Show Model Validation Progress with Keras model.fit()
Based on the documentation: Total number of steps (batches of samples) before declaring one epoch finished and starting the next epoch. When ...
Read more >
Training & evaluation with the built-in methods - Keras
This guide covers training, evaluation, and prediction (inference) models when using built-in APIs for training & validation (such as ...
Read more >
Callback — PyTorch Lightning 1.8.5.post0 documentation
The Timer callback tracks the time spent in the training, validation, and test loops and interrupts the Trainer if the given time limit...
Read more >
Callbacks - fastai
Basic callbacks for Learner. ... the end of the training phase of an epoch. before_validate : called at the beginning of the validation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found