class_docstr: The class for input to the PLM and Prompts. To make users explicitly know the available keys,
  we define a dict with a set of predefined possible keys. The default value to any key is None.
  When use it as a dict, all the keys whose values are None are invisible.
  
  This class support most of the dict's operation (See Examples). It can also be consumed by
  pytorch's default_collate in DataLoader.
  Also a :py:meth:`to_tensor()` method is build to convert the values into torch.Tensor for torch's input.
  
  Examples:
  
  ..  code-block:: python
  
      in_feat = InputFeatures(**{'input_ids':[1,4,5], 'soft_token_ids': [3,4,5]})  # init from dict
      print(in_feat.keys())       # ['input_ids, 'soft_token_ids']
      in_feat['label'] = 3        # can assign value like normal dict
      print(in_feat.keys())       # ['input_ids','label', 'soft_token_ids'] (Note that it's also ordered)
      print(in_feat['label'])     # 3
      in_feat['alice'] = 0        # KeyError: Key alice not in predefined set of keys
      in_feat.values()            # [[1,4,5], 3, [3,4,5]]  (Note that it's also ordered)
      [in_feat[key] for key in in_feat]   # [[1,4,5], 3, [3,4,5]]
      new_dict= {**in_feat, 'new_key':2}  # new_dict is {'input_ids': [1, 4, 5], 'label': 3, 'soft_token_ids': [3, 4, 5], 'new_key': 2}
  
  Args:
      input_ids: Indices of input sequence tokens in the vocabulary.
      attention_mask: Mask to avoid performing attention on padding token indices.
          Mask values selected in ``[0, 1]``: Usually ``1`` for tokens that are NOT MASKED, ``0`` for MASKED (padded)
          tokens.
      token_type_ids: (Optional) Segment token indices to indicate first and second
          portions of the inputs. Only some models use them.
      label: (Optional) Label corresponding to the input. Int for classification problems,
          float for regression problems.
code: def __init__(
      self,
      input_ids: Optional[Union[List, torch.Tensor]] = None,
      inputs_embeds: Optional[torch.Tensor] = None,
      attention_mask: Optional[Union[List[int], torch.Tensor]] = None,
      token_type_ids: Optional[Union[List[int], torch.Tensor]] = None,
      label: Optional[Union[int, torch.Tensor]] = None,
      decoder_input_ids: Optional[Union[List, torch.Tensor]] = None,
      decoder_inputs_embeds: Optional[torch.Tensor] = None,
      soft_token_ids: Optional[Union[List, torch.Tensor]] = None,
      past_key_values: Optional[
          torch.Tensor
      ] = None,  # for prefix_tuning
      loss_ids: Optional[Union[List, torch.Tensor]] = None,
      guid: Optional[str] = None,
      tgt_text: Optional[str] = None,
      use_cache: Optional[bool] = None,
      encoded_tgt_text: Optional[str] = None,
      input_ids_len: Optional[int] = None,
      **kwargs,
  ):
      self.input_ids = input_ids
      self.inputs_embeds = inputs_embeds
      self.attention_mask = attention_mask
      self.token_type_ids = token_type_ids
      self.label = label
      self.decoder_input_ids = decoder_input_ids
      self.decoder_inputs_embeds = decoder_inputs_embeds
      self.soft_token_ids = soft_token_ids
      self.past_key_values = past_key_values
      self.loss_ids = loss_ids
      self.guid = guid
      self.tgt_text = tgt_text
      self.encoded_tgt_text = encoded_tgt_text
      self.use_cache = use_cache
      self.input_ids_len = input_ids_len
  
      for k in kwargs.keys():
          logger.warning(
              "Your are passing an unexpected key words: {} to InputFeatures, might yield unexpected behaviours!".format(
                  k
              )
          )
          setattr(self, k, kwargs[k])
  
imports: import copy
  import json
  import pickle
  from typing import *
  import torch
  from torch.utils.data._utils.collate import default_collate
  from openprompt.utils.logging import logger
  from typing import Union
label_desc: Use image node_id 1 to create a new InputFeatures object from inherited base classes: dict with example: obj = InputFeatures(input_ids, inputs_embeds, attention_mask, token_type_ids, label, decoder_input_ids, decoder_inputs_embeds, soft_token_ids, past_key_values, loss_ids, guid, tgt_text, use_cache, encoded_tgt_text, input_ids_len)