class_docstr: Creates a Dataset for GPT architecture based Generative QA 
class_docstr_tok: ["Creates","a","Dataset","for","GPT","architecture","based","Generative","QA"]
docstr: Formats an answer into suitable model input:
      - In inference mode, answer is returned as an empty string, else
      - Sets EOS token as answer if question is impossible to answer, else
      - Appends answer with EOS token as the final answer
  Returns formatted answer string, answer tokens, and length of answer tokens
docstr_tok: ["Formats","an","answer","into","suitable","model","input",":","-","In","inference","mode",",","answer","is","returned","as","an","empty","string",",","else","-","Sets","EOS","token","as","answer","if","question","is","impossible","to","answer",",","else","-","Appends","answer","with","EOS","token","as","the","final","answer","Returns","formatted","answer","string",",","answer","tokens",",","and","length","of","answer","tokens"]
code: def _prep_answer(self, example):
      """
      Formats an answer into suitable model input:
          - In inference mode, answer is returned as an empty string, else
          - Sets EOS token as answer if question is impossible to answer, else
          - Appends answer with EOS token as the final answer
      Returns formatted answer string, answer tokens, and length of answer tokens
      """
  
      if self.mode == INFERENCE_MODE:
          target = ""
      elif (
          example.is_impossible
      ):  # example is impossible to answer given context
          target = self.tokenizer.tokenizer.eos_token
      else:
          target = f"{example.answer_text}{self.tokenizer.tokenizer.eos_token}"
  
      return self._get_truncated_sentence_and_len(
          target, self.max_answer_length
      )
  
imports: import copy
  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_gpt_input_example import GPTQAInputExample
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling the GPTQADataset obj's underlying member method code with example usage: obj._prep_answer(example) and returns: self