class_docstr: Generates a controllable_gen version of a ParlAI task, i.e., for tasks with multi-
  turn dialogues (episodes), this will generate a task with single example episodes,
  in which we append to the context a special classification token.
class_docstr_tok: ["Generates","a","controllable_gen","version","of","a","ParlAI","task",",","i.e.",",","for","tasks","with","multi-","turn","dialogues","(","episodes",")",",","this","will","generate","a","task","with","single","example","episodes",",","in","which","we","append","to","the","context","a","special","classification","token","."]
code: def add_cmdline_args(
      cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
  ) -> ParlaiParser:
      super().add_cmdline_args(parser, partial_opt)
      flattened = parser.add_argument_group(
          "ControllableTaskTeacher Flattening Args"
      )
      flattened.add_argument(
          "--flatten-include-labels",
          type="bool",
          default=True,
          help="Include labels in the history when flattening an episode",
      )
      flattened.add_argument(
          "--flatten-delimiter",
          type=str,
          default="\n",
          help="How to join the dialogue history from previous turns.",
      )
      flattened.add_argument(
          "--flatten-max-context-length",
          type=int,
          default=-1,
          help="Maximum number of utterances to include per episode. "
          "Default -1 keeps all.",
      )
      agent = parser.add_argument_group("ControllableTaskTeacher Args")
      agent.add_argument(
          "--invalidate-cache",
          type="bool",
          default=False,
          help="Set this to True to rebuild the data (may want to do this if "
          "original data has changed or you want to rebuild with new options)",
      )
      agent.add_argument(
          "--max-examples",
          type=int,
          default=-1,
          help="If greater than zero, will stop building after a certain num of exs",
      )
      agent.add_argument(
          "--fixed-control",
          type=str,
          default="",
          help="Always append this fixed control string, good for deploy time.",
      )
      # Add the arguments for the task teacher
      opt = parser.parse_and_process_known_args()[0]
      tasks = get_original_task_module(opt, multi_possible=True)
      for task in tasks:
          if hasattr(task, "add_cmdline_args"):
              task.add_cmdline_args(parser, partial_opt=partial_opt)
      return parser
  
imports: from parlai.core.params import ParlaiParser
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.utils.io import PathManager
  import parlai.utils.logging
  from parlai.utils.typing import TShared
  from parlai.tasks.genderation_bias.build import build
  from parlai.tasks.genderation_bias.utils import flatten_and_classify, get_original_task_module
  from copy import deepcopy
  import datetime
  import glob
  import json
  import os
  from tqdm import tqdm
  from typing import List, Optional, Tuple
label_desc: Use image node_id 1 for calling the ControllableTaskTeacher obj's underlying member method code with example usage: obj.add_cmdline_args(cls, parser, partial_opt) and returns: parser