class_docstr: Teacher for human safety evaluation on bot adversarial dialogues.
class_docstr_tok: ["Teacher","for","human","safety","evaluation","on","bot","adversarial","dialogues","."]
code: def _setup_data(self, path):
      super()._setup_data(path)
      new_episodes = []
      for ep in self.episodes:
          if self.opt["bad_include_persona"] is False:
              text_without_persona = "\n".join(
                  [
                      str_
                      for str_ in ep[0]["text"].split("\n")
                      if not str_.startswith("your persona: ")
                  ]
              )
              ep[0].force_set("text", text_without_persona)
          if self.opt["flatten_dialogue"]:
              dialog_text = "\n".join(
                  [
                      (exs["text"] + "\n" + exs["labels"][0])
                      for exs in ep[:-1]
                  ]
              )
              dialog_text = dialog_text + "\n" + ep[-1]["text"]
              msg = {
                  "text": dialog_text,
                  "labels": ep[-1]["labels"],
                  "episode_done": True,
                  "id": ep[0]["id"],
                  "human_eval_turn_range": ep[0][
                      "human_eval_turn_range"
                  ],
                  "convo_id": ep[0]["convo_id"],
              }
              msg = Message(msg)
              new_episodes.append([msg])
      if self.opt["flatten_dialogue"]:
          self.episodes = new_episodes
          self.num_exs = len(self.episodes)
  
imports: from typing import Optional, List
  from parlai.core.params import ParlaiParser
  import os
  from parlai.core.opt import Opt
  from parlai.core.teachers import ParlAIDialogTeacher
  from parlai.core.mutators import register_mutator, ManyEpisodeMutator
  from parlai.tasks.bot_adversarial_dialogue.build import build_dialogue_datasets, build_human_safety_eval_dataset, build_human_nonadv_safety_eval_dataset, get_adversarial_dialogue_folder, get_human_safety_eval_folder, get_human_nonadv_safety_eval_folder
  import parlai.utils.logging
  from parlai.utils.io import PathManager
  from parlai.utils.misc import str_to_msg
  from parlai.tasks.dialogue_safety.agents import OK_CLASS, NOT_OK_CLASS
  from parlai.core.message import Message
  from parlai.utils.misc import warn_once
label_desc: Use image node_id 3 for calling the HumanSafetyEvaluationTeacher obj's underlying member method code with example usage: obj._setup_data(path) without return types