class_docstr: Base class for all the templates.
  Most of methods are abstract, with some exceptions to hold the common methods for all template, such as ``loss_ids``, ``save``, ``load``.
  
  Args:
      tokenizer (:obj:`PreTrainedTokenizer`): A tokenizer to appoint the vocabulary and the tokenization strategy.
      placeholder_mapping (:obj:`dict`): A place holder to represent the original input text.
class_docstr_tok: ["Base","class","for","all","the","templates",".","Most","of","methods","are","abstract",",","with","some","exceptions","to","hold","the","common","methods","for","all","template",",","such","as","``","loss_ids","``",",","``","save","``",",","``","load","``",".","Args",":","tokenizer","(",":","obj",":","`","PreTrainedTokenizer","`",")",":","A","tokenizer","to","appoint","the","vocabulary","and","the","tokenization","strategy",".","placeholder_mapping","(",":","obj",":","`","dict","`",")",":","A","place","holder","to","represent","the","original","input","text","."]
docstr: Given an input example which contains input text, which can be referenced
  by self.template.placeholder_mapping 's value.
  This function process the example into a list of dict,
  Each dict functions as a group, which has the sample properties, such as
  whether it's shortenable, whether it's the masked position, whether it's soft token, etc.
  Since a text will be tokenized in the subsequent processing procedure,
  these attributes are broadcasted along the tokenized sentence.
  
  Args:
      example (:obj:`InputExample`): An :py:class:`~openprompt.data_utils.data_utils.InputExample` object, which should have attributes that are able to be filled in the template.
  
  Returns:
      :obj:`List[Dict]`: A list of dict of the same length as self.text. e.g. ``[{"loss_ids": 0, "text": "It was"}, {"loss_ids": 1, "text": "<mask>"}, ]``
code: def wrap_one_example(self, example: InputExample) -> List[Dict]:
      r"""Given an input example which contains input text, which can be referenced
      by self.template.placeholder_mapping 's value.
      This function process the example into a list of dict,
      Each dict functions as a group, which has the sample properties, such as
      whether it's shortenable, whether it's the masked position, whether it's soft token, etc.
      Since a text will be tokenized in the subsequent processing procedure,
      these attributes are broadcasted along the tokenized sentence.
  
      Args:
          example (:obj:`InputExample`): An :py:class:`~openprompt.data_utils.data_utils.InputExample` object, which should have attributes that are able to be filled in the template.
  
      Returns:
          :obj:`List[Dict]`: A list of dict of the same length as self.text. e.g. ``[{"loss_ids": 0, "text": "It was"}, {"loss_ids": 1, "text": "<mask>"}, ]``
      """
  
      if self.text is None:
          raise ValueError("template text has not been initialized")
      if isinstance(example, InputExample):
          text = self.incorporate_text_example(example)
  
          not_empty_keys = example.keys()
          for placeholder_token in self.placeholder_mapping:
              not_empty_keys.remove(
                  self.placeholder_mapping[placeholder_token]
              )  # placeholder has been processed, remove
          not_empty_keys.remove("meta")  # meta has been processed
  
          keys, values = ["text"], [text]
          for inputflag_name in self.registered_inputflag_names:
              keys.append(inputflag_name)
              v = None
              if (
                  hasattr(self, inputflag_name)
                  and getattr(self, inputflag_name) is not None
              ):
                  v = getattr(self, inputflag_name)
              elif hasattr(self, "get_default_" + inputflag_name):
                  v = getattr(self, "get_default_" + inputflag_name)()
                  setattr(self, inputflag_name, v)  # cache
              else:
                  raise ValueError(
                      """
                      Template's inputflag '{}' is registered but not initialize.
                      Try using template.{} = [...] to initialize
                      or create an method get_default_{}(self) in your template.
                      """.format(
                          inputflag_name, inputflag_name, inputflag_name
                      )
                  )
  
              if len(v) != len(text):
                  raise ValueError(
                      "Template: len({})={} doesn't match len(text)={}.".format(
                          inputflag_name, len(v), len(text)
                      )
                  )
              values.append(v)
          wrapped_parts_to_tokenize = []
          for piece in list(zip(*values)):
              wrapped_parts_to_tokenize.append(dict(zip(keys, piece)))
  
          wrapped_parts_not_tokenize = {
              key: getattr(example, key) for key in not_empty_keys
          }
          return [wrapped_parts_to_tokenize, wrapped_parts_not_tokenize]
      else:
          raise TypeError("InputExample")
  
imports: from abc import abstractmethod
  import json
  from transformers.file_utils import ModelOutput
  from openprompt.config import convert_cfg_to_dict
  from transformers.utils.dummy_pt_objects import PreTrainedModel
  from openprompt.utils.utils import signature
  from yacs.config import CfgNode
  from openprompt.data_utils import InputFeatures, InputExample
  import torch
  import torch.nn
  from typing import *
  from transformers.tokenization_utils import PreTrainedTokenizer
  from openprompt.utils.logging import logger
  import numpy
  import torch.nn.functional
label_desc: Use image node_id 8 for calling the Template obj's underlying member method code with example usage: obj.wrap_one_example(example) and returns: list