code: def __init__(
      self,
      data_file: str,
      tokenizer: AutoTokenizer,
      max_length: int = 96,
  ) -> None:
      super(EasyPromptsDataset, self).__init__()
      with open(data_file, "r", encoding="UTF-8") as f:
          all_lines = f.readlines()
          all_lines = [
              line
              if "回答：" not in line
              else line[: line.index("回答：") + 3]
              for line in all_lines
          ]
      self.prompts = [
          tokenizer(
              line,
              return_tensors="pt",
              max_length=max_length,
              padding="max_length",
              truncation=True,
          )["input_ids"]
          .to(torch.cuda.current_device())
          .squeeze(0)
          for line in tqdm(all_lines)
      ]
      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 EasyPromptsDataset object from inherited base classes: Dataset with example: obj = EasyPromptsDataset(data_file, tokenizer, max_length)