class_docstr: Include characters, inline candidates to train a generator with multiple objectives.
class_docstr_tok: ["Include","characters",",","inline","candidates","to","train","a","generator","with","multiple","objectives","."]
code: def _setup_data(self, path):
      super()._setup_data(path)
      logging.info("Building Candidates")
      self.candidates = SpeakerClassifierTeacher._build_candidates(
          self.episodes
      )
      logging.info("Setting up character labels")
      for ep in self.episodes:
          context_str = ep[0]["text"]
          for ex in ep:
              n_cands = self.opt["num_train_inline_candidates"]
              if n_cands > 0 and DatatypeHelper.is_training(
                  self.datatype
              ):
                  speaker, listener = extract_characters(
                      context_str
                  ).values()
                  label_cands = [speaker, listener]
                  while (
                      speaker in label_cands and listener in label_cands
                  ):
                      label_cands = random.sample(
                          self.candidates, n_cands - 2
                      )
                  label_cands += [speaker, listener]
                  random.shuffle(label_cands)
              else:
                  label_cands = self.candidates
              ex.force_set("character_candidates", label_cands)
  
imports: from abc import ABC
  from collections import deque
  import re
  from typing import Optional
  from parlai.core.build_data import modelzoo_path
  from parlai.core.message import Message
  from parlai.core.metrics import AverageMetric
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.tasks.light_dialog.agents import SimpleMultiTeacher
  from parlai.utils.data import DatatypeHelper
  import parlai.utils.logging
  import copy
  import os
  import random
  import torch
  import torch.nn
  import torch.nn.functional
  from typing import List, Dict, Tuple
  from projects.light_whoami.task.utils import DEFAULT_DELIM, CONTEXT_KEYS, extract_characters, WHO_AM_I, WHO_ARE_YOU, SELF, PARTNER, WHO_IS_THIS, maybe_annotate
  import projects.light_whoami.task.mutators
label_desc: Use image node_id 2 for calling the MultiObjectiveTeacher obj's underlying member method code with example usage: obj._setup_data(path) without return types