code: def load_data(self):
      with open(self.path, "r", encoding="utf-8") as fp:
          lines = fp.readlines()
      self.insts = []
      for line in lines:
          inst = json.loads(line)
          inst_len = len(inst["pieces"])
          if inst_len > self.max_length:
              continue
          self.insts.append(inst)
  
      for inst in self.insts:
          doc_id = inst["doc_id"]
          wnd_id = inst["wnd_id"]
          tokens = inst["tokens"]
          pieces = inst["pieces"]
          if "retrieval" in inst.keys():
              retrieval = inst["retrieval"]
          else:
              retrieval = []
          event_types = []
          knowledge = {}
          if len(retrieval) > 0:
              for index, item in enumerate(retrieval):
                  for et in item[1]:
                      if et in maven2ace.keys():
                          et = maven2ace[et]
                      if et in knowledge.keys():
                          knowledge[et].append(item[0])
                      else:
                          knowledge[et] = [item[0]]
                      knowledge[et] = list(set(knowledge[et]))
                  event_types.extend(item[1])
          # print(knowledge)
          # print(len(pieces))
          # print(len(knowledge_tokens))
          entities = inst["entity_mentions"]
          if self.fair_compare:
              entities, entity_id_map = remove_overlap_entities(
                  entities
              )
          else:
              entities = entities
              entity_id_map = {}
  
          events = inst["event_mentions"]
          events.sort(key=lambda x: x["trigger"]["start"])
  
          token_num = len(tokens)
          token_lens = inst["token_lens"]
  
          piece_idxs = self.tokenizer.convert_tokens_to_ids(pieces)
          assert sum(token_lens) == len(piece_idxs)
  
          triggers = [
              (
                  e["trigger"]["start"],
                  e["trigger"]["end"],
                  e["event_type"],
              )
              for e in events
          ]
          roles = get_role_list(entities, events, entity_id_map)
  
          token_start_idxs = [
              sum(token_lens[:_]) for _ in range(len(token_lens))
          ] + [sum(token_lens)]
  
          instance = EEInstance(
              doc_id=doc_id,
              wnd_id=wnd_id,
              tokens=tokens,
              pieces=pieces,
              piece_idxs=piece_idxs,
              token_lens=token_lens,
              token_start_idxs=token_start_idxs,
              triggers=triggers,
              roles=roles,
              knowledge=knowledge,
              event_types=event_types,
          )
          self.data.append(instance)
  
      logger.info(
          f"Loaded {len(self)}/{len(lines)} instances from {self.path}"
      )
  
imports: import json, logging, pickle
  from mimetypes import knownfiles
  from unittest.mock import NonCallableMagicMock
  import torch
  from torch.utils.data import Dataset
  from collections import namedtuple
label_desc: Use image node_id 6 for calling the EEDataset obj's underlying member method code with example usage: obj.load_data() without return types