Browse Source

修复fitlogcallback增加launch_time的bug

tags/v1.0.0alpha
yhcc 2 years ago
parent
commit
de5d5597e7
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      fastNLP/core/callbacks/fitlog_callback.py
  2. +1
    -1
      fastNLP/core/callbacks/progress_callback.py

+ 1
- 1
fastNLP/core/callbacks/fitlog_callback.py View File

@@ -44,7 +44,7 @@ class FitlogCallback(HasMonitorCallback):
if get_global_rank() != 0: # 如果不是 global rank 为 0 ,需要关闭 fitlog if get_global_rank() != 0: # 如果不是 global rank 为 0 ,需要关闭 fitlog
fitlog.debug() fitlog.debug()
super().on_after_trainer_initialized(trainer, driver) super().on_after_trainer_initialized(trainer, driver)
fitlog.add_other('launch_time', os.environ['FASTNLP_LAUNCH_TIME'])
fitlog.add_other(name='launch_time', value=os.environ['FASTNLP_LAUNCH_TIME'])


def on_sanity_check_end(self, trainer, sanity_check_res): def on_sanity_check_end(self, trainer, sanity_check_res):
super(FitlogCallback, self).on_sanity_check_end(trainer, sanity_check_res) super(FitlogCallback, self).on_sanity_check_end(trainer, sanity_check_res)


+ 1
- 1
fastNLP/core/callbacks/progress_callback.py View File

@@ -25,7 +25,7 @@ class ProgressCallback(HasMonitorCallback):
def record_better_monitor(self, trainer, results): def record_better_monitor(self, trainer, results):
self.best_monitor_step = trainer.global_forward_batches self.best_monitor_step = trainer.global_forward_batches
self.best_monitor_epoch = trainer.cur_epoch_idx self.best_monitor_epoch = trainer.cur_epoch_idx
self.best_results = results
self.best_results = self.itemize_results(results)


def on_train_end(self, trainer): def on_train_end(self, trainer):
if self.best_monitor_epoch != -1: if self.best_monitor_epoch != -1:


Loading…
Cancel
Save