docstr: vis_root (string): Root directory of images (e.g. coco/images/)
  ann_root (string): directory to store the annotation file
docstr_tok: ["vis_root","(","string",")",":","Root","directory","of","images","(","e.g",".","coco\/images\/",")","ann_root","(","string",")",":","directory","to","store","the","annotation","file"]
code: def __init__(
      self,
      data_path,
      data_debug_path,
      per_sample_image,
      tokenizer,
      vis_processor=None,
      vis_root=None,
      ann_paths=[],
      add_eos=True,
      ignore_instruction=True,
      sample_image=False,
      annotation_key=None,
  ):
      """
      vis_root (string): Root directory of images (e.g. coco/images/)
      ann_root (string): directory to store the annotation file
      """
      if hasattr(tokenizer, "add_eos_token"):
          assert (
              tokenizer.add_eos_token is False
          ), "tokenizer should not add eos token by default"
      self.tokenizer: LlamaTokenizer = tokenizer
      self.data_path = data_path
      self.data_debug_path = data_debug_path
      self.data_debug_counter = 0
      self.vis_root = vis_root
      self.per_sample_image = per_sample_image
      print("check tokenizer", self.tokenizer)
      self.annotation = []
      for ann_path in ann_paths:
          if annotation_key is None:
              self.annotation.extend(json.load(open(ann_path, "r")))
          else:
              self.annotation.extend(
                  json.load(open(ann_path, "r"))[annotation_key]
              )
      self.sample_image = sample_image
      if self.sample_image:
          print("randomly sample one annotation for each image")
          self.annotation = self.parse_annotation(self.annotation)
  
      self.annotation = DST.random_grouping(
          self.annotation, self.per_sample_image
      )
  
      self.vis_processor = vis_processor
  
      self.option_prob = 0.5
      self.prompter = DST.Prompter()
      self.add_eos = add_eos
      self.ignore_instruction = ignore_instruction
      self.system_instruct = None
      self.image_token_dict = DST.get_image_num_map(self.tokenizer)
      self.cat_number()
  
imports: import copy
  import json
  import os
  import random
  from collections import defaultdict
  from typing import Iterable
  import numpy
  import torch
  from PIL import Image
  from torch.utils.data import ConcatDataset, Dataset
  from transformers import LlamaTokenizer
  import utils.data.DST
  from utils.utils import get_rank
  from .utils import save_debug_image, save_debug_text
  import re
label_desc: Use image node_id 1 to create a new VQADataset object from inherited base classes: Dataset with example: obj = VQADataset(data_path, data_debug_path, per_sample_image, tokenizer, vis_processor, vis_root, ann_paths, add_eos, ignore_instruction, sample_image, annotation_key)