class_docstr: Wizard of Wikipedia Gender gender.
class_docstr_tok: ["Wizard","of","Wikipedia","Gender","gender","."]
code: def _setup_data(self, opt):
      # Load map from image ID to gender
      data = self._load_gender_data(opt)
  
      extra_data = []
      if self.add_unknown_classes:
          for ex in data:
              self_ex = deepcopy(ex)
              self_ex["label"] = f"SELF:{gend_utils.UNKNOWN}"
              self_ex["class_type"] = "self"
              extra_data.append(self_ex)
  
              partner_ex = deepcopy(ex)
              partner_ex["label"] = f"PARTNER:{gend_utils.UNKNOWN}"
              partner_ex["class_type"] = "partner"
              extra_data.append(partner_ex)
  
      if len(extra_data) > 0:
          # possibly sample unknown classes
          sample_rate = self.opt["unknown_temp"]
          if sample_rate < 1.0:
              to_samp = int(sample_rate * len(extra_data))
              sampled = random.sample(extra_data, to_samp)
              data += sampled
          else:
              data += extra_data
  
      if self.is_train:
          random.shuffle(data)
  
      gend_utils.get_data_stats(data, key="label", lst=False)
  
      return data
  
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
  import parlai.tasks.md_gender.utils
  from parlai.tasks.md_gender.build import build
  from copy import deepcopy
  import json
  import os
  import random
label_desc: Use image node_id 4 for calling the WizardTeacher obj's underlying member method code with example usage: obj._setup_data(opt) and returns: data