code: def load_from_file(self, mode="train"):
      load_file = os.path.join(self.args.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()
          words, relations, heads, tails, imgids, dataid = (
              [],
              [],
              [],
              [],
              [],
              [],
          )
          for i, line in enumerate(lines):
              line = ast.literal_eval(line)  # str to dict
              words.append(line["token"])
              relations.append(line["relation"])
              heads.append(line["h"])  # {name, pos}
              tails.append(line["t"])
              imgids.append(line["img_id"])
              dataid.append(i)
  
      assert (
          len(words)
          == len(relations)
          == len(heads)
          == len(tails)
          == (len(imgids))
      )
  
      # 辅助图像
      aux_imgs = None
      # if not self.use_clip_vit:
      aux_path = os.path.join(
          self.args.cwd, self.data_path[mode + "_auximgs"]
      )
      aux_imgs = torch.load(aux_path)
      rcnn_imgs = torch.load(
          os.path.join(
              self.args.cwd, self.data_path[mode + "_img2crop"]
          )
      )
      return {
          "words": words,
          "relations": relations,
          "heads": heads,
          "tails": tails,
          "imgids": imgids,
          "dataid": dataid,
          "aux_imgs": aux_imgs,
          "rcnn_imgs": rcnn_imgs,
      }
  
file_path: DeepKE/src/deepke/relation_extraction/multimodal/modules/dataset.py
imports: import random
  import os
  import torch
  import json
  import ast
  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 MMREProcessor obj's underlying member method code with example usage: obj.load_from_file(mode) and returns: dict