code: def __init__(
      self,
      data_file: str,
      tokenizer: AutoTokenizer,
      max_length: int = 512,
  ) -> None:
      super(EasySupervisedDataset, self).__init__()
      with open(data_file, "r", encoding="UTF-8") as f:
          all_lines = f.readlines()
      # split to source and target ,source the characters before "回答：" including "回答：", target the characters after "回答："
      sources, targets = [], []
      for line in all_lines:
          if "回答：" in line:
              sep_index = line.index("回答：")
              sources.append(line[: sep_index + 3])
              targets.append(
                  line[sep_index + 3 :] + tokenizer.eos_token
              )
          else:
              sources.append(line)
              targets.append("" + tokenizer.eos_token)
      data_dict = preprocess(sources, targets, tokenizer, max_length)
  
      self.input_ids = data_dict["input_ids"]
      self.labels = data_dict["labels"]
      self.data_file = data_file
  
imports: import copy
  import json
  from typing import Dict, Sequence
  import torch
  from torch.utils.data import Dataset
  from tqdm import tqdm
  from transformers import AutoTokenizer
label_desc: Use image node_id 1 to create a new EasySupervisedDataset object from inherited base classes: Dataset with example: obj = EasySupervisedDataset(data_file, tokenizer, max_length)