class_docstr: A runner for prototypical verbalizer
  This class is specially implemented for classification.
  
  Args:
      model (:obj:`PromptForClassification`): One ``PromptForClassification`` 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.
class_docstr_tok: ["A","runner","for","prototypical","verbalizer","This","class","is","specially","implemented","for","classification",".","Args",":","model","(",":","obj",":","`","PromptForClassification","`",")",":","One","``","PromptForClassification","``","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 fit(self, ckpt: Optional[str] = None):
      self.set_stop_criterion()
      self.configure_optimizers()
  
      if ckpt:
          if not self.load_checkpoint(ckpt):
              logger.warning("Train from scratch instead ...")
      if self.cur_epoch == 0:
          self.on_fit_start()
  
      for self.cur_epoch in range(self.cur_epoch, self.num_epochs):
          continue_training = self.training_epoch(self.cur_epoch)
          score = self.inference_epoch("validation")
          copy = None
          if (
              self.best_score is None
              or ((score - self.best_score) >= 0)
              == self.config.checkpoint.higher_better
          ):
              copy = "best"
              self.best_score = score
          self.save_checkpoint(
              "last", extra={"validation_metric": score}, copy=copy
          )
          if continue_training == -1:
              logger.info(
                  "Stop training by reaching maximum num_training_steps"
              )
              break
          if self.config.train.train_verblizer == "alternate":
              self.inner_model.verbalizer.train_proto(
                  self.model,
                  self.train_dataloader,
                  self.config.environment.local_rank,
              )
  
      if self.config.train.train_verblizer == "post":
          self.inner_model.verbalizer.train_proto(
              self.model,
              self.train_dataloader,
              self.config.environment.local_rank,
          )
  
      return self.best_score
  
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.trainer import BaseRunner, ClassificationRunner
  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 8 for calling the ProtoVerbClassificationRunner obj's underlying member method code with example usage: obj.fit(ckpt) and returns: self