class_docstr: 通过该Callback实现训练过程中loss的输出
docstr: 在每经过一定batch或最后一个batch时输出当前epoch截止目前的平均loss
docstr_tok: ["\u5728\u6bcf\u7ecf\u8fc7\u4e00\u5b9abatch\u6216\u6700\u540e\u4e00\u4e2abatch\u65f6\u8f93\u51fa\u5f53\u524depoch\u622a\u6b62\u76ee\u524d\u7684\u5e73\u5747loss"]
code: def on_train_batch_end(self, trainer):
      """
      在每经过一定batch或最后一个batch时输出当前epoch截止目前的平均loss
      """
      if (
          trainer.batch_idx_in_epoch % self.print_every_batch == 0
          or trainer.batch_idx_in_epoch == trainer.num_batches_per_epoch
      ):
          print(
              "\tBatch: {} Loss: {}".format(
                  trainer.batch_idx_in_epoch,
                  self.loss / trainer.batch_idx_in_epoch,
              )
          )
  
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 6 for calling the PrintWhileTrainingCallBack obj's underlying member method code with example usage: obj.on_train_batch_end(trainer) without return types