Browse Source

update FitlogCallback使它在使用update_every时也能正确记录loss

tags/v0.5.5
yh_cc 4 years ago
parent
commit
ce6b72232a
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      fastNLP/core/callback.py

+ 1
- 1
fastNLP/core/callback.py View File

@@ -574,7 +574,7 @@ class FitlogCallback(Callback):
if self._log_loss_every>0:
self._avg_loss += loss.item()
if self.step%self._log_loss_every==0:
fitlog.add_loss(self._avg_loss/self._log_loss_every, name='loss', step=self.step, epoch=self.epoch)
fitlog.add_loss(self._avg_loss/self._log_loss_every*self.update_every, name='loss', step=self.step, epoch=self.epoch)
self._avg_loss = 0

def on_valid_end(self, eval_result, metric_key, optimizer, better_result):


Loading…
Cancel
Save