Perform evaluation upon training completion (#1529)

pull/1531/head
Zhihao Lin 2024-04-08 13:05:36 +08:00 committed by GitHub
parent 2c4516c622
commit e258c84824
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -98,7 +98,8 @@ class EpochBasedTrainLoop(BaseLoop):
self._decide_current_val_interval()
if (self.runner.val_loop is not None
and self._epoch >= self.val_begin
and self._epoch % self.val_interval == 0):
and (self._epoch % self.val_interval == 0
or self._epoch == self._max_epochs)):
self.runner.val_loop.run()
self.runner.call_hook('after_train')
@ -288,7 +289,8 @@ class IterBasedTrainLoop(BaseLoop):
self._decide_current_val_interval()
if (self.runner.val_loop is not None
and self._iter >= self.val_begin
and self._iter % self.val_interval == 0):
and (self._iter % self.val_interval == 0
or self._iter == self._max_iters)):
self.runner.val_loop.run()
self.runner.call_hook('after_train_epoch')