class_docstr: 通过该Callback实现训练过程中loss的输出
docstr: 在每经过一定epoch或最后一个epoch时输出当前epoch的平均loss和使用时间
docstr_tok: ["\u5728\u6bcf\u7ecf\u8fc7\u4e00\u5b9aepoch\u6216\u6700\u540e\u4e00\u4e2aepoch\u65f6\u8f93\u51fa\u5f53\u524depoch\u7684\u5e73\u5747loss\u548c\u4f7f\u7528\u65f6\u95f4"]
code: def on_train_epoch_end(self, trainer):
      """
      在每经过一定epoch或最后一个epoch时输出当前epoch的平均loss和使用时间
      """
      if (
          trainer.cur_epoch_idx % self.print_every_epoch == 0
          or trainer.cur_epoch_idx == trainer.n_epochs
      ):
          print(
              "Epoch: {} Loss: {} Current epoch training time: {}s".format(
                  trainer.cur_epoch_idx,
                  self.loss / trainer.num_batches_per_epoch,
                  time.time() - self.epoch_start,
              )
          )
      # 将loss清零
      self.loss = 0
  
imports: import os
  import sys
  import time
  from datasets import load_dataset
  from datasets import DatasetDict
  import jittor
  from jittor import nn, Module
  from jittor.dataset import Dataset
  from fastNLP.core.controllers.trainer import Trainer
  from fastNLP.core.metrics.accuracy import Accuracy
  from fastNLP.core.vocabulary import Vocabulary
  from fastNLP.core.callbacks.progress_callback import RichCallback
  from fastNLP.core.callbacks.callback import Callback
  from fastNLP.core.dataloaders.jittor_dataloader.fdl import JittorDataLoader
label_desc: Use image node_id 5 for calling the PrintWhileTrainingCallBack obj's underlying member method code with example usage: obj.on_train_epoch_end(trainer) without return types