class_docstr: 通过该Callback实现训练过程中loss的输出
docstr: 每次反向传播前统计loss，用于计算平均值
docstr_tok: ["\u6bcf\u6b21\u53cd\u5411\u4f20\u64ad\u524d\u7edf\u8ba1loss\uff0c\u7528\u4e8e\u8ba1\u7b97\u5e73\u5747\u503c"]
code: def on_before_backward(self, trainer, outputs):
      """
      每次反向传播前统计loss，用于计算平均值
      """
      loss = trainer.extract_loss_from_outputs(outputs)
      loss = trainer.driver.tensor_to_numeric(loss)
      self.loss += loss
  
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 3 for calling the PrintWhileTrainingCallBack obj's underlying member method code with example usage: obj.on_before_backward(trainer, outputs) without return types