class_docstr: Teacher that builds up Message objects based on child `question and answer` and
  `reason` classes.
  
  Also handles making exemplars.
class_docstr_tok: ["Teacher","that","builds","up","Message","objects","based","on","child","`","question","and","answer","`","and","`","reason","`","classes",".","Also","handles","making","exemplars","."]
code: def _data_generator(self, fold) -> Iterable[Message]:
      example_separator = self.opt.get("example_separator_token")
      inner_separator = self.opt.get("inner_separator_token")
      skip_perturbation_failures = self.opt.get(
          "skip_perturbation_failures"
      )
  
      prompt_and_examplars = self._build_prompt_and_exemplars(
          inner_separator,
          example_separator,
      )
  
      #### Set up individual examples
      for example in self.get_data_for_fold(fold):
          reason_tuple = None
          if self.opt.get("include_reason", True):
              try:
                  reason_tuple = (
                      self.reason_instance.get_full_reason_text(example)
                  )
              except (RuntimeError, IndexError) as e:
                  if skip_perturbation_failures:
                      print(f"WARNING: {e}")
                      continue
                  else:
                      raise e
          message = self._message_from_example(
              example=example,
              prompt_and_examplars=prompt_and_examplars,
              inner_separator=inner_separator,
              reason_tuple=reason_tuple,
          )
          yield message
  
imports: from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.params import ParlaiParser
  from parlai.core.teachers import DialogTeacher
  from tqdm import tqdm
  from typing import Any, Dict, Iterable, List, Optional, Tuple
label_desc: Use image node_id 10 for calling the AbstractReasoningTeacher obj's underlying member method code with example usage: obj._data_generator(fold) without return types