class_docstr: Creates a Dataset for T5/BART architecture based Generative QA 
class_docstr_tok: ["Creates","a","Dataset","for","T5\/BART","architecture","based","Generative","QA"]
docstr: Iterates through each QA example, formats into input and output template,
      and encodes the input and output template
  Input template: `context: <context text> question: <question text>`
  Output template: `<answer text>`
docstr_tok: ["Iterates","through","each","QA","example",",","formats","into","input","and","output","template",",","and","encodes","the","input","and","output","template","Input","template",":","`","context",":","<","context","text",">","question",":","<","question","text",">","`","Output","template",":","`","<","answer","text",">","`"]
code: def _convert_examples_to_features(self):
      """
      Iterates through each QA example, formats into input and output template,
          and encodes the input and output template
      Input template: `context: <context text> question: <question text>`
      Output template: `<answer text>`
      """
  
      logging.info(f"Preprocessing data into features.")
  
      unique_id = 1000000000
      self.features = []
      context_prefix = "context: "
      context_prefix_tokens = self.tokenizer.tokenizer.tokenize(
          context_prefix
      )
  
      for example_index in trange(len(self.examples)):
          if example_index % 1000 == 0:
              S2SQADataset.check_if_sufficient_memory()
  
          example = self.examples[example_index]
  
          query_tokens, formatted_query = self._prep_query(example)
          context_tokens, context_spans = self._prep_context(
              example, query_tokens, context_prefix_tokens
          )
  
          unique_id = self._encode_all_context_spans(
              unique_id,
              context_spans,
              context_tokens,
              formatted_query,
              example,
              example_index,
          )
  
      # delete self.examples during training mode to save memory
      if self.mode == TRAINING_MODE:
          self.examples = []
          del self.processor
  
file_path: NeMo/nemo/collections/nlp/data/question_answering/dataset/qa_s2s_dataset.py
imports: import os
  import numpy
  import torch
  from tqdm import trange
  from nemo.collections.nlp.data.question_answering.data_processor.qa_processing import INFERENCE_MODE, TRAINING_MODE
  from nemo.collections.nlp.data.question_answering.dataset.qa_dataset import QADataset
  from nemo.collections.nlp.data.question_answering.input_example.qa_s2s_input_example import S2SQAInputExample
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the S2SQADataset obj's underlying member method code with example usage: obj._convert_examples_to_features() without return types