code: def load_from_file(self, mode="train"):
      load_file = os.path.join(self.cwd, self.data_path[mode])
      logger.info("Loading data from {}".format(load_file))
      with open(load_file, "r", encoding="utf-8") as f:
          lines = f.readlines()
          raw_words, raw_targets = [], []
          raw_word, raw_target = [], []
          imgs = []
          for line in lines:
              if line.startswith("IMGID:"):
                  img_id = line.strip().split("IMGID:")[1] + ".jpg"
                  imgs.append(img_id)
                  continue
              if line != "\n":
                  raw_word.append(line.split("\t")[0])
                  label = line.split("\t")[1][:-1]
                  if "OTHER" in label:
                      label = label[:2] + "MISC"
                  raw_target.append(label)
              else:
                  raw_words.append(raw_word)
                  raw_targets.append(raw_target)
                  raw_word, raw_target = [], []
  
      assert (
          len(raw_words) == len(raw_targets) == len(imgs)
      ), "{}, {}, {}".format(
          len(raw_words), len(raw_targets), len(imgs)
      )
      aux_imgs = None
      # if not self.use_clip_vit:
      aux_path = os.path.join(
          self.cwd, self.data_path[mode + "_auximgs"]
      )
      aux_imgs = torch.load(aux_path)
  
      rcnn_imgs = torch.load(
          os.path.join(self.cwd, self.data_path["img2crop"])
      )
  
      return {
          "words": raw_words,
          "targets": raw_targets,
          "imgs": imgs,
          "aux_imgs": aux_imgs,
          "rcnn_imgs": rcnn_imgs,
      }
  
file_path: DeepKE/src/deepke/name_entity_re/multimodal/modules/dataset.py
imports: import torch
  import os
  from PIL import Image
  from torch.utils.data import Dataset
  from transformers import BertTokenizer, CLIPProcessor
  import logging
label_desc: Use image node_id 2 for calling the MMPNERProcessor obj's underlying member method code with example usage: obj.load_from_file(mode) and returns: dict