code: def preprocess(self, raw_contents: list):
      processed_data_items = []
      use_ie = self.graph_name == "ie"  # hard code
      for raw_sentence in raw_contents:
          if self.data_item_class == DoubleText2TextDataItem:
              assert isinstance(
                  raw_sentence, (tuple, list)
              ), "Expect two inputs for DoubleText2TextDataItem, only one found."
              data_item = self.data_item_class(
                  input_text=raw_sentence[0],
                  input_text2=raw_sentence[1],
                  output_text=None,
                  tokenizer=self.tokenizer,
                  share_vocab=self.share_vocab,
              )
          elif self.data_item_class == KGCompletionDataItem:
              assert isinstance(raw_sentence, tuple)
              line = json.loads(raw_sentence[0])
              e1, rel, e2, rel_eval, e2_multi1, e2_multi2 = (
                  line["e1"],
                  line["rel"],
                  line["e2"],
                  line["rel_eval"],
                  line["e2_multi1"],
                  line["e2_multi2"],
              )
              data_item = self.data_item_class(
                  e1,
                  rel,
                  e2,
                  rel_eval,
                  e2_multi1,
                  e2_multi2,
                  tokenizer=self.tokenizer,
              )
          elif self.data_item_class == Text2TreeDataItem:
              data_item = self.data_item_class(
                  input_text=raw_sentence,
                  output_text=None,
                  output_tree=None,
                  tokenizer=self.tokenizer,
              )
          elif self.data_item_class == Text2LabelDataItem:
              data_item = self.data_item_class(
                  input_text=raw_sentence, tokenizer=self.tokenizer
              )
          else:
              data_item = self.data_item_class(
                  input_text=raw_sentence,
                  tokenizer=self.tokenizer,
                  output_text=None,
              )
  
          data_item = self.dataset.process_data_items(
              data_items=[data_item]
          )
          data_item = self.dataset._vectorize_one_dataitem(
              data_item[0], self.vocab_model, use_ie=use_ie
          )
          processed_data_items.append(data_item)
      return processed_data_items
  
file_path: graph4nlp/graph4nlp/pytorch/inference_wrapper/base.py
imports: import json
  from typing import Union
  import torch.nn
  from graph4nlp.pytorch.data.dataset import DataItem, Dataset, DoubleText2TextDataItem, KGCompletionDataItem, Text2LabelDataItem, Text2TreeDataItem, word_tokenize
  from graph4nlp.pytorch.modules.graph_construction.base import DynamicGraphConstructionBase, StaticGraphConstructionBase
label_desc: Use image node_id 2 for calling the InferenceWrapperBase obj's underlying member method code with example usage: obj.preprocess(raw_contents) and returns: processed_data_items