class_docstr: MDGender data collected on Mechanical Turk.
class_docstr_tok: ["MDGender","data","collected","on","Mechanical","Turk","."]
code: def __init__(self, opt, shared=None):
      self.opt = opt
      self.labels_to_use = opt["labels_to_use"]
      self.is_train = (
          "train" in opt["datatype"]
          and "evalmode" not in opt["datatype"]
      )
      self.is_valid = "valid" in opt["datatype"]
      self.label_candidates = gend_utils.ALL_CANDS
  
      if shared is None:
          # set map
          self.data = self._setup_data(opt)
          if (self.is_train and opt["balance"]) or (
              self.is_valid and opt["balance_valid"]
          ):
              to_exclude = (
                  ["ABOUT:non-binary"],
              )  # not enough non-binary examples to balance
              self.data = gend_utils.balance_data(
                  self.data, key="labels", exclude_labels=to_exclude
              )
      else:
          self.data = shared["data"]
      super().__init__(opt, shared)
      self.reset()
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.tasks.md_gender.build import build
  import parlai.tasks.md_gender.utils
  import json
  import os
  import random
label_desc: Use image node_id 2 to create a new MdGenderTeacher object from inherited base classes: FixedDialogTeacher with example: obj = MdGenderTeacher(opt, shared)