class_docstr: Teacher for Image Grounded Conversations (IGC) Task.
  
  See https://arxiv.org/abs/1701.08251 for more details
class_docstr_tok: ["Teacher","for","Image","Grounded","Conversations","(","IGC",")","Task",".","See","https",":","\/\/arxiv.org\/abs\/1701.08251","for","more","details"]
docstr: Override to load CSV files.
code: def load_data(self, data_path: str, opt: Opt) -> List[Dict[str, Any]]:
      """
      Override to load CSV files.
      """
  
      dt = opt["datatype"].split(":")[0]
      dt_str = "test" if dt == "test" else "val"
      dp = os.path.join(
          self.get_data_path(opt), f"IGC_crowd_{dt_str}.csv"
      )
      if not os.path.exists(dp):
          raise RuntimeError(
              "Please download the IGC Dataset from "
              "https://www.microsoft.com/en-us/download/details.aspx?id=55324. "
              "Then, make sure to put the two .csv files in {}".format(
                  self.get_data_path(opt)
              )
          )
      if (
          not os.path.exists(self.get_image_path(opt))
          or len(os.listdir(self.get_image_path(opt))) <= 1
      ):
          self._download_images(opt)
  
      self.data = []
      with PathManager.open(dp, newline="\n") as csv_file:
          reader = csv.reader(csv_file, delimiter=",")
          fields = []
          for i, row in enumerate(reader):
              if i == 0:
                  fields = row
              else:
                  ep = dict(zip(fields, row))
                  ep["image_id"] = f'{ep["id"]}'
                  self.data.append(ep)
  
      if dt == "train":
          # Take first 90% of valid set as train
          self.data = self.data[: int(len(self.data) * 0.9)]
      elif dt == "valid":
          self.data = self.data[int(len(self.data) * 0.9) :]
  
      self.valid_image_ids = []
      for d in self.data:
          img_path = os.path.join(
              self.get_image_path(opt), d["image_id"]
          )
          if PathManager.exists(img_path):
              self.valid_image_ids.append(d["image_id"])
  
      self.valid_image_ids = set(self.valid_image_ids)
      return self.data
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  import csv
  import os
  from abc import ABC, abstractmethod
  from PIL import Image
  from typing import List, Dict, Any
  from parlai.core.build_data import download_multiprocess
  from parlai.core.params import Opt
  from parlai.core.teachers import AbstractImageTeacher
  from parlai.utils.io import PathManager
  import parlai.utils.typing
label_desc: Use image node_id 9 for calling the IGCTeacher obj's underlying member method code with example usage: obj.load_data(data_path, opt) and returns: self