class_docstr: A base runner for training without training tricks.
  Applying training tricks such as ensemble of template or verbalizer,
  or self-training can use other runner class.
  This class is specially implemented for classification.
  For generation task, though it can be integrated in this class
  via `task` option, we keep it as another class for simplicity.
  
  Args:
      model (:obj:`nn.Module`): One ``nn.Module`` object.
      train_dataloader (:obj:`PromptDataloader`, optional): The dataloader to bachify and process the training data.
      valid_dataloader (:obj:`PromptDataloader`, optionla): The dataloader to bachify and process the val data.
      test_dataloader (:obj:`PromptDataloader`, optional): The dataloader to bachify and process the test data.
      config (:obj:`CfgNode`): A configuration object.
      loss_function (:obj:`Callable`, optional): The loss function in the training process.
code: def training_epoch(self, epoch):
      self.model.train()
      self.model.zero_grad()
      total_loss = 0.0
      sum_loss = 0.0
      with tqdm(
          total=self.steps_per_epoch, desc=f"train epoch: {epoch}"
      ) as pbar:
          for batch_idx, batch in enumerate(self.train_dataloader):
              batch = batch.to(
                  "cuda:{}".format(self.config.environment.local_rank)
              ).to_dict()
  
              loss = self.training_step(batch, batch_idx)
  
              if self.config.train.gradient_accumulation_steps > 1:
                  loss = (
                      loss
                      / self.config.train.gradient_accumulation_steps
                  )
              sum_loss += loss.item()
              loss.backward()
              if (
                  batch_idx + 1
              ) % self.config.train.gradient_accumulation_steps == 0:
                  pbar.set_postfix({"loss": sum_loss})
                  self.log("train/loss", sum_loss, self.global_step)
                  # logger.info("{} {}".format(self.inner_model.template.soft_embeds.data.mean().item(),self.global_step))
  
                  if self.config.train.max_grad_norm > 0:
                      torch.nn.utils.clip_grad_norm_(
                          self.model.parameters(),
                          self.config.train.max_grad_norm,
                      )
  
                  for optimizer in self.optimizers:
                      optimizer.step()
                  for scheduler in self.schedulers:
                      scheduler.step()
                  for optimizer in self.optimizers:
                      optimizer.zero_grad()
  
                  total_loss += sum_loss
                  sum_loss = 0.0
                  self.global_step += 1
                  pbar.update(1)
              if self.global_step >= self.num_training_steps:
                  logger.info(
                      f"Training epoch {epoch}, num_steps {self.global_step}, avg_loss: {total_loss/self.steps_per_epoch:.4f}, total_loss: {total_loss:.4f}"
                  )
                  return -1  # an indicator of stopping the training
      logger.info(
          f"Training epoch {epoch}, num_steps {self.global_step},  avg_loss: {total_loss/self.steps_per_epoch:.4f}, total_loss: {total_loss:.4f}"
      )
      return 1
  
imports: import os, shutil
  import sys
  import torch
  from torch import nn
  from torch.nn.parallel.data_parallel import DataParallel
  from openprompt.utils.cuda import model_to_device
  from tensorboardX import SummaryWriter
  from tqdm import tqdm
  import dill
  import warnings
  from typing import Callable, Union, Dict
  from openprompt.pipeline_base import PromptForClassification, PromptForGeneration
  from openprompt import PromptDataLoader
  from openprompt.prompts import *
  from openprompt.utils.logging import logger
  from openprompt.utils.metrics import classification_metrics, generation_metric
  from transformers import AdamW, get_linear_schedule_with_warmup
  from transformers.optimization import Adafactor, AdafactorSchedule
label_desc: Use image node_id 14 for calling the BaseRunner obj's underlying member method code with example usage: obj.training_epoch(epoch) and returns: int, unknown