code: def update_stat_and_print(
      args,
      print_rank_0,
      forward_step,
      stat_history,
      optimizer,
      arrange_out,
      ds_config,
  ):
      eval_result, previous_best, best_dev_acc, save_model = (
          arrange_out[0],
          arrange_out[1],
          arrange_out[2],
          arrange_out[3],
      )
      print_rank_0(
          f"***** Running evaluation Stage {args.distill_method}*****"
      )
      print_rank_0(
          "  {} step of {}".format(forward_step, args.max_train_steps)
      )
  
      past_loss = stat_history["tmp_loss"]
      tr_loss, tr_rep_loss, tr_cls_loss, tr_att_loss = (
          past_loss[0],
          past_loss[1],
          past_loss[2],
          past_loss[3],
      )
      loss = tr_loss / (args.eval_step + 1)
      cls_loss = tr_cls_loss / (args.eval_step + 1)
      att_loss = tr_att_loss / (args.eval_step + 1)
      rep_loss = tr_rep_loss / (args.eval_step + 1)
  
      stat_history["lr1"].append(optimizer.param_groups[0]["lr"])
      stat_history["lr2"].append(optimizer.param_groups[1]["lr"])
      stat_history["train_ffn_loss"].append(rep_loss)
      stat_history["train_att_loss"].append(att_loss)
      stat_history["train_loss"].append(loss)
      stat_history["eval"].append(eval_result)
      stat_history["forward_step"].append(forward_step)
      teacher_result = stat_history["teacher_result"]
      try:
          print_rank_0(
              "{"
              + f"eval_result: {eval_result}, step: {forward_step/args.max_train_steps}, train_loss: {stat_history['train_loss'][-1]}, train_ffn_loss: {stat_history['train_ffn_loss'][-1]},  train_att_loss:{stat_history['train_att_loss'][-1]}, lr1: { stat_history['lr1'][-1]}, lr2: { stat_history['lr2'][-1]}, "
              + "}"
          )
      except:
          print_rank_0(eval_result)
      if previous_best is not None:
          print_rank_0(
              f"task {args.task_name}, teacher_result: {teacher_result}\nPrevious best: {previous_best}"
          )
  
      tr_loss, tr_rep_loss, tr_cls_loss, tr_att_loss = (
          0.0,
          0.0,
          0.0,
          0.0,
      )
      stat_history["tmp_loss"] = [
          0,
          0.0,
          0.0,
          0.0,
      ]
  
      ##############for pruning
      sparse_prune, row_prune, head_prune = False, False, False
      sparse_iter, row_iter, head_iter = 0, 0, 0
      if ds_config["compression_training"]["sparse_pruning"][
          "shared_parameters"
      ]["enabled"]:
          sparse_prune = True
          sparse_iter = ds_config["compression_training"][
              "sparse_pruning"
          ]["shared_parameters"]["schedule_offset"]
      if ds_config["compression_training"]["row_pruning"][
          "shared_parameters"
      ]["enabled"]:
          row_prune = True
          row_iter = ds_config["compression_training"]["row_pruning"][
              "shared_parameters"
          ]["schedule_offset"]
      if ds_config["compression_training"]["head_pruning"][
          "shared_parameters"
      ]["enabled"]:
          head_prune = True
          head_iter = ds_config["compression_training"]["head_pruning"][
              "shared_parameters"
          ]["schedule_offset"]
      if sparse_prune or row_prune or head_prune:
          save_iter = np.max([sparse_iter, row_iter, head_iter])
          if forward_step < save_iter:
              save_model = False
              best_dev_acc = 0
      return stat_history, best_dev_acc, save_model
  
imports: import torch
  from torch.nn import CrossEntropyLoss, MSELoss
  import datasets
  from datasets import load_dataset, load_metric
  import copy
  import os
  import json
  import transformers
  from transformers import AutoConfig, PretrainedConfig
  import huggingface_transformer
  from huggingface_transformer.modeling_bert import BertForSequenceClassification
  import logging
  import numpy
  import math
label_desc: Use image node_id 11 for calling a global function with example usage: update_stat_and_print(args, print_rank_0, forward_step, stat_history, optimizer, arrange_out, ds_config) and returns: stat_history,  best_dev_acc,  save_model