From b39562108a90ae6a2de447cbbff11b96eb64a2b5 Mon Sep 17 00:00:00 2001 From: Jakub Cieslik Date: Mon, 14 Oct 2019 12:33:23 +0200 Subject: [PATCH] fixing broken fastai callback, it was logging the loss during the validation phase. (#63) * fix broken fastai callback --- neptunecontrib/monitoring/fastai.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neptunecontrib/monitoring/fastai.py b/neptunecontrib/monitoring/fastai.py index ef68bb7..d6ab761 100644 --- a/neptunecontrib/monitoring/fastai.py +++ b/neptunecontrib/monitoring/fastai.py @@ -91,5 +91,7 @@ def on_epoch_end(self, **kwargs): metric_name = getattr(metric_name, '__name__', metric_name) self._exp.send_metric(self._prefix + str(metric_name), float(metric_value)) - def on_batch_end(self, **kwargs): - self._exp.send_metric('{}last_loss'.format(self._prefix), float(kwargs['last_loss'])) + def on_batch_end(self, last_loss, iteration, train, **kwars): + if iteration == 0 or not train: + return + self._exp.send_metric('{}last_loss'.format(self._prefix), last_loss)