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: Fromats all spans extracted from a single context as:
      `context: <context span text> question: <question text> answer: <answer text>` and encodes
  If the answer text (example.answer_text) is not present in a given context span,
      the answer is converted to a blank answer
docstr_tok: ["Fromats","all","spans","extracted","from","a","single","context","as",":","`","context",":","<","context","span","text",">","question",":","<","question","text",">","answer",":","<","answer","text",">","`","and","encodes","If","the","answer","text","(","example.answer_text",")","is","not","present","in","a","given","context","span",",","the","answer","is","converted","to","a","blank","answer"]
code: def _encode_all_context_spans(
      self,
      unique_id,
      context_spans,
      context_tokens,
      formatted_query,
      example,
      example_index,
  ):
      """
      Fromats all spans extracted from a single context as:
          `context: <context span text> question: <question text> answer: <answer text>` and encodes
      If the answer text (example.answer_text) is not present in a given context span,
          the answer is converted to a blank answer
      """
  
      for context_span_idx, context_span in enumerate(context_spans):
          # format query and context span text
          context_span_tokens = context_tokens[
              context_span.start : context_span.start
              + context_span.length
          ]
          context_span_text = (
              self.tokenizer.tokenizer.convert_tokens_to_string(
                  context_span_tokens
              )
          )
          source = f"context: {context_span_text}{formatted_query}"
  
          # encode input
          encoded_input_dict = self.tokenizer.tokenizer(
              source,
              truncation=True,
              max_length=self.max_seq_length,
              padding="max_length",
              return_tensors="pt",
          )
          input_ids = torch.squeeze(encoded_input_dict["input_ids"])
          input_attn_mask = torch.squeeze(
              encoded_input_dict["attention_mask"]
          )
  
          # encode output based on mode and is question answerable given context
          labels = self._encode_answer(example, context_span_text)
  
          # create dictionary features
          feature = {
              "unique_id": unique_id,
              "input_ids": input_ids,
              "input_attn_mask": input_attn_mask,
              "labels": labels,
              "example_index": example_index,
              "context_span_index": context_span_idx,
              "is_impossible": example.is_impossible,
          }
  
          self.features.append(feature)
          unique_id += 1
  
      return unique_id
  
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 6 for calling the S2SQADataset obj's underlying member method code with example usage: obj._encode_all_context_spans(unique_id, context_spans, context_tokens, formatted_query, example, example_index) and returns: unique_id