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","."]
docstr: config the loss function if it's not passed.
docstr_tok: ["config","the","loss","function","if","it","'s","not","passed","."]
code: def configure_loss_function(
      self,
  ):
      r"""config the loss function if it's not passed."""
      if self.config.classification.loss_function == "cross_entropy":
          return torch.nn.CrossEntropyLoss()
      elif self.config.classification.loss_function == "nll_loss":
          return torch.nn.NLLLoss()
      else:
          raise NotImplementedError
  
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 2 for calling the ProtoVerbClassificationRunner obj's underlying member method code with example usage: obj.configure_loss_function() and returns: torch, torch