class_docstr: COCO default teacher that expects open-ended descriptions of images.
class_docstr_tok: ["COCO","default","teacher","that","expects","open-ended","descriptions","of","images","."]
code: def get(self, episode_idx, entry_idx=0):
      action = {"episode_done": True}
  
      if self.use_intro:
          action["text"] = QUESTION
  
      if self.version == "2014":
          ep = self.annotation[episode_idx]
          action["labels"] = [s["raw"] for s in ep["sentences"]]
          action["image_id"] = ep["cocoid"]
          action["split"] = ep["split"]
          if not self.datatype.startswith("train"):
              if self.num_cands > 0:
                  labels = action["labels"]
                  cands_to_sample = [
                      c for c in self.cands if c not in labels
                  ]
                  cands = (
                      random.Random(episode_idx).sample(
                          cands_to_sample, self.num_cands
                      )
                  ) + labels
                  random.shuffle(cands)
                  action["label_candidates"] = cands
              else:
                  action["label_candidates"] = self.cands
      else:
          if not self.datatype.startswith("test"):
              # test set annotations are not available for this dataset
              anno = self.annotation[episode_idx]
              action["labels"] = [anno["caption"]]
              action["image_id"] = anno["image_id"]
              if not self.datatype.startswith("train"):
                  if self.num_cands == -1:
                      candidates = self.cands
                  else:
                      # Can only randomly select from validation set
                      candidates = random.Random(episode_idx).choices(
                          self.cands, k=self.num_cands
                      )
                  if anno["caption"] not in candidates:
                      candidates.pop(0)
                  else:
                      candidates.remove(anno["caption"])
  
                  candidate_labels = [anno["caption"]]
                  candidate_labels += candidates
                  action["label_candidates"] = candidate_labels
          else:
              if self.num_cands == -1:
                  candidates = self.cands
              else:
                  # Can only randomly select from validation set
                  candidates = random.Random(episode_idx).choices(
                      self.cands, k=self.num_cands
                  )
              action["label_candidates"] = candidates
              action["image_id"] = self.test_info["images"][
                  episode_idx
              ]["id"]
  
      return action
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.core.image_featurizers import ImageLoader
  from parlai.utils.io import PathManager
  from .build_2014 import build
  from .build_2014 import buildImage
  from .build_2017 import build
  from .build_2017 import buildImage
  import os
  import json
  import random
label_desc: Use image node_id 7 for calling the DefaultTeacher obj's underlying member method code with example usage: obj.get(episode_idx, entry_idx) and returns: action