class_docstr: The ``QuestionAnsweringData`` class is a :class:`~flash.core.data.data_module.DataModule` with a set of
  classmethods for loading data for extractive question answering.
class_docstr_tok: ["The","``","QuestionAnsweringData","``","class","is","a",":","class",":","`","~flash.core.data.data_module.DataModule","`","with","a","set","of","classmethods","for","loading","data","for","extractive","question","answering","."]
docstr: Load the :class:`~flash.text.question_answering.data.QuestionAnsweringData` from JSON files containing
  questions, contexts and their corresponding answers in the SQuAD2.0 format.
  
  Question snippets will be extracted from the ``question_column_name`` column in the JSON files.
  Context snippets will be extracted from the ``context_column_name`` column in the JSON files.
  Answer snippets will be extracted from the ``answer_column_name`` column in the JSON files.
  To learn how to customize the transforms applied for each stage, read our
  :ref:`customizing transforms guide <customizing_transforms>`.
  
  Args:
      train_file: The JSON file containing the training data.
      val_file: The JSON file containing the validation data.
      test_file: The JSON file containing the testing data.
      predict_file: The JSON file containing the predict data.
      input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
      transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
      transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
      question_column_name: The key in the JSON file to recognize the question field.
      context_column_name: The key in the JSON file to recognize the context field.
      answer_column_name: The key in the JSON file to recognize the answer field.
  
  Returns:
      The constructed data module.
  
  Examples
  ________
  
  .. testsetup::
  
      >>> import json
      >>> from pathlib import Path
      >>> train_data = Path("train_data.json")
      >>> predict_data = Path("predict_data.json")
      >>> _ = train_data.write_text(
      ...     json.dumps(
      ...         {
      ...             "version": "v2.0",
      ...             "data": [
      ...                 {
      ...                     "title": "ExampleSet1",
      ...                     "paragraphs": [
      ...                         {
      ...                             "qas": [
      ...                                 {
      ...                                     "question": "this is a question one",
      ...                                     "id": "12345",
      ...                                     "answers": [{"text": "this is an answer one", "answer_start": 0}],
      ...                                     "is_impossible": False,
      ...                                 }
      ...                             ],
      ...                             "context": "this is an answer one. this is a context one",
      ...                         },
      ...                         {
      ...                             "qas": [
      ...                                 {
      ...                                     "question": "this is a question two",
      ...                                     "id": "12346",
      ...                                     "answers": [{"text": "this is an answer two", "answer_start": 0}],
      ...                                     "is_impossible": False,
      ...                                 }
      ...                             ],
      ...                             "context": "this is an answer two. this is a context two",
      ...                         },
      ...                     ],
      ...                 },
      ...                 {
      ...                     "title": "ExampleSet2",
      ...                     "paragraphs": [
      ...                         {
      ...                             "qas": [
      ...                                 {
      ...                                     "question": "this is a question three",
      ...                                     "id": "12347",
      ...                                     "answers": [{"text": "this is an answer three", "answer_start": 0}],
      ...                                     "is_impossible": False,
      ...                                 }
      ...                             ],
      ...                             "context": "this is an answer three. this is a context three",
      ...                         },
      ...                         {
      ...                             "qas": [
      ...                                 {
      ...                                     "question": "this is a question four",
      ...                                     "id": "12348",
      ...                                     "answers": [{"text": "this is an answer four", "answer_start": 0}],
      ...                                     "is_impossible": False,
      ...                                 }
      ...                             ],
      ...                             "context": "this is an answer four. this is a context four",
      ...                         },
      ...                     ],
      ...                 },
      ...             ],
      ...         }
      ...     )
      ... )
      >>> _ = predict_data.write_text(
      ...     json.dumps(
      ...         {
      ...             "version": "v2.0",
      ...             "data": [
      ...                 {
      ...                     "title": "ExampleSet3",
      ...                     "paragraphs": [
      ...                         {
      ...                             "qas": [
      ...                                 {
      ...                                     "question": "this is a question five",
      ...                                     "id": "12349",
      ...                                     "is_impossible": False,
      ...                                 }
      ...                             ],
      ...                             "context": "this is an answer five. this is a context five",
      ...                         },
      ...                         {
      ...                             "qas": [
      ...                                 {
      ...                                     "question": "this is a question six",
      ...                                     "id": "12350",
      ...                                     "is_impossible": False,
      ...                                 }
      ...                             ],
      ...                             "context": "this is an answer six. this is a context six",
      ...                         },
      ...                     ],
      ...                 }
      ...             ],
      ...         }
      ...     )
      ... )
  
  The file ``train_data.json`` contains the following:
  
  .. code-block::
  
      {
          "version": "v2.0",
          "data": [
              {
                  "title": "ExampleSet1",
                  "paragraphs": [
                      {
                          "qas": [
                              {
                                  "question": "this is a question one",
                                  "id": "12345",
                                  "answers": [{"text": "this is an answer one", "answer_start": 0}],
                                  "is_impossible": false
                              }
                          ],
                          "context": "this is an answer one. this is a context one"
                      }, {
                          "qas": [
                              {
                                  "question": "this is a question two",
                                  "id": "12346",
                                  "answers": [{"text": "this is an answer two", "answer_start": 0}],
                                  "is_impossible": false
                              }
                          ],
                          "context": "this is an answer two. this is a context two"
                      }
                  ]
              }, {
                  "title": "ExampleSet2",
                  "paragraphs": [
                      {
                          "qas": [
                              {
                                  "question": "this is a question three",
                                  "id": "12347",
                                  "answers": [{"text": "this is an answer three", "answer_start": 0}],
                                  "is_impossible": false
                              }
                          ],
                          "context": "this is an answer three. this is a context three"
                      }, {
                          "qas": [
                              {
                                  "question": "this is a question four",
                                  "id": "12348",
                                  "answers": [{"text": "this is an answer four", "answer_start": 0}],
                                  "is_impossible": false
                              }
                          ],
                          "context": "this is an answer four. this is a context four"
                      }
                  ]
              }
          ]
      }
  
  
  The file ``predict_data.json`` contains the following:
  
  .. code-block::
  
      {
          "version": "v2.0",
          "data": [
              {
                  "title": "ExampleSet3",
                  "paragraphs": [
                      {
                          "qas": [
                              {
                                  "question": "this is a question five",
                                  "id": "12349",
                                  "is_impossible": false
                              }
                          ],
                          "context": "this is an answer five. this is a context five"
                      }, {
                          "qas": [
                              {
                                  "question": "this is a question six",
                                  "id": "12350",
                                  "is_impossible": false
                              }
                          ],
                          "context": "this is an answer six. this is a context six"
                      }
                  ]
              }
          ]
      }
  
  .. doctest::
  
      >>> from flash import Trainer
      >>> from flash.text import QuestionAnsweringData, QuestionAnsweringTask
      >>> datamodule = QuestionAnsweringData.from_squad_v2(
      ...     train_file="train_data.json",
      ...     predict_file="predict_data.json",
      ...     batch_size=2,
      ... )  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      >>> model = QuestionAnsweringTask(max_source_length=32, max_target_length=32)
      >>> trainer = Trainer(fast_dev_run=True)
      >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Training...
      >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Predicting...
  
  .. testcleanup::
  
      >>> import os
      >>> os.remove("train_data.json")
      >>> os.remove("predict_data.json")
docstr_tok: ["Load","the",":","class",":","`","~flash.text.question_answering.data.QuestionAnsweringData","`","from","JSON","files","containing","questions",",","contexts","and","their","corresponding","answers","in","the","SQuAD2.0","format",".","Question","snippets","will","be","extracted","from","the","``","question_column_name","``","column","in","the","JSON","files",".","Context","snippets","will","be","extracted","from","the","``","context_column_name","``","column","in","the","JSON","files",".","Answer","snippets","will","be","extracted","from","the","``","answer_column_name","``","column","in","the","JSON","files",".","To","learn","how","to","customize","the","transforms","applied","for","each","stage",",","read","our",":","ref",":","`","customizing","transforms","guide","<","customizing_transforms",">","`",".","Args",":","train_file",":","The","JSON","file","containing","the","training","data",".","val_file",":","The","JSON","file","containing","the","validation","data",".","test_file",":","The","JSON","file","containing","the","testing","data",".","predict_file",":","The","JSON","file","containing","the","predict","data",".","input_cls",":","The",":","class",":","`","~flash.core.data.io.input.Input","`","type","to","use","for","loading","the","data",".","transform",":","The",":","class",":","`","~flash.core.data.io.input_transform.InputTransform","`","type","to","use",".","transform_kwargs",":","Dict","of","keyword","arguments","to","be","provided","when","instantiating","the","transforms",".","question_column_name",":","The","key","in","the","JSON","file","to","recognize","the","question","field",".","context_column_name",":","The","key","in","the","JSON","file","to","recognize","the","context","field",".","answer_column_name",":","The","key","in","the","JSON","file","to","recognize","the","answer","field",".","Returns",":","The","constructed","data","module",".","Examples","________","..","testsetup",":",":",">",">",">","import","json",">",">",">","from","pathlib","import","Path",">",">",">","train_data","=","Path","(","``","train_data.json","''",")",">",">",">","predict_data","=","Path","(","``","predict_data.json","''",")",">",">",">","_","=","train_data.write_text","(","...","json.dumps","(","...","{","...","``","version","''",":","``","v2.0","''",",","...","``","data","''",":","[","...","{","...","``","title","''",":","``","ExampleSet1","''",",","...","``","paragraphs","''",":","[","...","{","...","``","qas","''",":","[","...","{","...","``","question","''",":","``","this","is","a","question","one","''",",","...","``","id","''",":","``","12345","''",",","...","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","one","''",",","``","answer_start","''",":","0","}","]",",","...","``","is_impossible","''",":","False",",","...","}","...","]",",","...","``","context","''",":","``","this","is","an","answer","one",".","this","is","a","context","one","''",",","...","}",",","...","{","...","``","qas","''",":","[","...","{","...","``","question","''",":","``","this","is","a","question","two","''",",","...","``","id","''",":","``","12346","''",",","...","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","two","''",",","``","answer_start","''",":","0","}","]",",","...","``","is_impossible","''",":","False",",","...","}","...","]",",","...","``","context","''",":","``","this","is","an","answer","two",".","this","is","a","context","two","''",",","...","}",",","...","]",",","...","}",",","...","{","...","``","title","''",":","``","ExampleSet2","''",",","...","``","paragraphs","''",":","[","...","{","...","``","qas","''",":","[","...","{","...","``","question","''",":","``","this","is","a","question","three","''",",","...","``","id","''",":","``","12347","''",",","...","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","three","''",",","``","answer_start","''",":","0","}","]",",","...","``","is_impossible","''",":","False",",","...","}","...","]",",","...","``","context","''",":","``","this","is","an","answer","three",".","this","is","a","context","three","''",",","...","}",",","...","{","...","``","qas","''",":","[","...","{","...","``","question","''",":","``","this","is","a","question","four","''",",","...","``","id","''",":","``","12348","''",",","...","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","four","''",",","``","answer_start","''",":","0","}","]",",","...","``","is_impossible","''",":","False",",","...","}","...","]",",","...","``","context","''",":","``","this","is","an","answer","four",".","this","is","a","context","four","''",",","...","}",",","...","]",",","...","}",",","...","]",",","...","}","...",")","...",")",">",">",">","_","=","predict_data.write_text","(","...","json.dumps","(","...","{","...","``","version","''",":","``","v2.0","''",",","...","``","data","''",":","[","...","{","...","``","title","''",":","``","ExampleSet3","''",",","...","``","paragraphs","''",":","[","...","{","...","``","qas","''",":","[","...","{","...","``","question","''",":","``","this","is","a","question","five","''",",","...","``","id","''",":","``","12349","''",",","...","``","is_impossible","''",":","False",",","...","}","...","]",",","...","``","context","''",":","``","this","is","an","answer","five",".","this","is","a","context","five","''",",","...","}",",","...","{","...","``","qas","''",":","[","...","{","...","``","question","''",":","``","this","is","a","question","six","''",",","...","``","id","''",":","``","12350","''",",","...","``","is_impossible","''",":","False",",","...","}","...","]",",","...","``","context","''",":","``","this","is","an","answer","six",".","this","is","a","context","six","''",",","...","}",",","...","]",",","...","}","...","]",",","...","}","...",")","...",")","The","file","``","train_data.json","``","contains","the","following",":","..","code-block",":",":","{","``","version","''",":","``","v2.0","''",",","``","data","''",":","[","{","``","title","''",":","``","ExampleSet1","''",",","``","paragraphs","''",":","[","{","``","qas","''",":","[","{","``","question","''",":","``","this","is","a","question","one","''",",","``","id","''",":","``","12345","''",",","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","one","''",",","``","answer_start","''",":","0","}","]",",","``","is_impossible","''",":","false","}","]",",","``","context","''",":","``","this","is","an","answer","one",".","this","is","a","context","one","''","}",",","{","``","qas","''",":","[","{","``","question","''",":","``","this","is","a","question","two","''",",","``","id","''",":","``","12346","''",",","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","two","''",",","``","answer_start","''",":","0","}","]",",","``","is_impossible","''",":","false","}","]",",","``","context","''",":","``","this","is","an","answer","two",".","this","is","a","context","two","''","}","]","}",",","{","``","title","''",":","``","ExampleSet2","''",",","``","paragraphs","''",":","[","{","``","qas","''",":","[","{","``","question","''",":","``","this","is","a","question","three","''",",","``","id","''",":","``","12347","''",",","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","three","''",",","``","answer_start","''",":","0","}","]",",","``","is_impossible","''",":","false","}","]",",","``","context","''",":","``","this","is","an","answer","three",".","this","is","a","context","three","''","}",",","{","``","qas","''",":","[","{","``","question","''",":","``","this","is","a","question","four","''",",","``","id","''",":","``","12348","''",",","``","answers","''",":","[","{","``","text","''",":","``","this","is","an","answer","four","''",",","``","answer_start","''",":","0","}","]",",","``","is_impossible","''",":","false","}","]",",","``","context","''",":","``","this","is","an","answer","four",".","this","is","a","context","four","''","}","]","}","]","}","The","file","``","predict_data.json","``","contains","the","following",":","..","code-block",":",":","{","``","version","''",":","``","v2.0","''",",","``","data","''",":","[","{","``","title","''",":","``","ExampleSet3","''",",","``","paragraphs","''",":","[","{","``","qas","''",":","[","{","``","question","''",":","``","this","is","a","question","five","''",",","``","id","''",":","``","12349","''",",","``","is_impossible","''",":","false","}","]",",","``","context","''",":","``","this","is","an","answer","five",".","this","is","a","context","five","''","}",",","{","``","qas","''",":","[","{","``","question","''",":","``","this","is","a","question","six","''",",","``","id","''",":","``","12350","''",",","``","is_impossible","''",":","false","}","]",",","``","context","''",":","``","this","is","an","answer","six",".","this","is","a","context","six","''","}","]","}","]","}","..","doctest",":",":",">",">",">","from","flash","import","Trainer",">",">",">","from","flash.text","import","QuestionAnsweringData",",","QuestionAnsweringTask",">",">",">","datamodule","=","QuestionAnsweringData.from_squad_v2","(","...","train_file=","''","train_data.json","''",",","...","predict_file=","''","predict_data.json","''",",","...","batch_size=2",",","...",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE",">",">",">","model","=","QuestionAnsweringTask","(","max_source_length=32",",","max_target_length=32",")",">",">",">","trainer","=","Trainer","(","fast_dev_run=True",")",">",">",">","trainer.fit","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Training","...",">",">",">","trainer.predict","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Predicting","...","..","testcleanup",":",":",">",">",">","import","os",">",">",">","os.remove","(","``","train_data.json","''",")",">",">",">","os.remove","(","``","predict_data.json","''",")"]
code: def from_squad_v2(
      cls,
      train_file: Optional[str] = None,
      val_file: Optional[str] = None,
      test_file: Optional[str] = None,
      predict_file: Optional[str] = None,
      input_cls: Type[Input] = QuestionAnsweringSQuADInput,
      transform: INPUT_TRANSFORM_TYPE = InputTransform,
      transform_kwargs: Optional[Dict] = None,
      question_column_name: str = "question",
      context_column_name: str = "context",
      answer_column_name: str = "answer",
      **data_module_kwargs: Any,
  ) -> "QuestionAnsweringData":
      """Load the :class:`~flash.text.question_answering.data.QuestionAnsweringData` from JSON files containing
      questions, contexts and their corresponding answers in the SQuAD2.0 format.
  
      Question snippets will be extracted from the ``question_column_name`` column in the JSON files.
      Context snippets will be extracted from the ``context_column_name`` column in the JSON files.
      Answer snippets will be extracted from the ``answer_column_name`` column in the JSON files.
      To learn how to customize the transforms applied for each stage, read our
      :ref:`customizing transforms guide <customizing_transforms>`.
  
      Args:
          train_file: The JSON file containing the training data.
          val_file: The JSON file containing the validation data.
          test_file: The JSON file containing the testing data.
          predict_file: The JSON file containing the predict data.
          input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
          transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
          transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
          question_column_name: The key in the JSON file to recognize the question field.
          context_column_name: The key in the JSON file to recognize the context field.
          answer_column_name: The key in the JSON file to recognize the answer field.
  
      Returns:
          The constructed data module.
  
      Examples
      ________
  
      .. testsetup::
  
          >>> import json
          >>> from pathlib import Path
          >>> train_data = Path("train_data.json")
          >>> predict_data = Path("predict_data.json")
          >>> _ = train_data.write_text(
          ...     json.dumps(
          ...         {
          ...             "version": "v2.0",
          ...             "data": [
          ...                 {
          ...                     "title": "ExampleSet1",
          ...                     "paragraphs": [
          ...                         {
          ...                             "qas": [
          ...                                 {
          ...                                     "question": "this is a question one",
          ...                                     "id": "12345",
          ...                                     "answers": [{"text": "this is an answer one", "answer_start": 0}],
          ...                                     "is_impossible": False,
          ...                                 }
          ...                             ],
          ...                             "context": "this is an answer one. this is a context one",
          ...                         },
          ...                         {
          ...                             "qas": [
          ...                                 {
          ...                                     "question": "this is a question two",
          ...                                     "id": "12346",
          ...                                     "answers": [{"text": "this is an answer two", "answer_start": 0}],
          ...                                     "is_impossible": False,
          ...                                 }
          ...                             ],
          ...                             "context": "this is an answer two. this is a context two",
          ...                         },
          ...                     ],
          ...                 },
          ...                 {
          ...                     "title": "ExampleSet2",
          ...                     "paragraphs": [
          ...                         {
          ...                             "qas": [
          ...                                 {
          ...                                     "question": "this is a question three",
          ...                                     "id": "12347",
          ...                                     "answers": [{"text": "this is an answer three", "answer_start": 0}],
          ...                                     "is_impossible": False,
          ...                                 }
          ...                             ],
          ...                             "context": "this is an answer three. this is a context three",
          ...                         },
          ...                         {
          ...                             "qas": [
          ...                                 {
          ...                                     "question": "this is a question four",
          ...                                     "id": "12348",
          ...                                     "answers": [{"text": "this is an answer four", "answer_start": 0}],
          ...                                     "is_impossible": False,
          ...                                 }
          ...                             ],
          ...                             "context": "this is an answer four. this is a context four",
          ...                         },
          ...                     ],
          ...                 },
          ...             ],
          ...         }
          ...     )
          ... )
          >>> _ = predict_data.write_text(
          ...     json.dumps(
          ...         {
          ...             "version": "v2.0",
          ...             "data": [
          ...                 {
          ...                     "title": "ExampleSet3",
          ...                     "paragraphs": [
          ...                         {
          ...                             "qas": [
          ...                                 {
          ...                                     "question": "this is a question five",
          ...                                     "id": "12349",
          ...                                     "is_impossible": False,
          ...                                 }
          ...                             ],
          ...                             "context": "this is an answer five. this is a context five",
          ...                         },
          ...                         {
          ...                             "qas": [
          ...                                 {
          ...                                     "question": "this is a question six",
          ...                                     "id": "12350",
          ...                                     "is_impossible": False,
          ...                                 }
          ...                             ],
          ...                             "context": "this is an answer six. this is a context six",
          ...                         },
          ...                     ],
          ...                 }
          ...             ],
          ...         }
          ...     )
          ... )
  
      The file ``train_data.json`` contains the following:
  
      .. code-block::
  
          {
              "version": "v2.0",
              "data": [
                  {
                      "title": "ExampleSet1",
                      "paragraphs": [
                          {
                              "qas": [
                                  {
                                      "question": "this is a question one",
                                      "id": "12345",
                                      "answers": [{"text": "this is an answer one", "answer_start": 0}],
                                      "is_impossible": false
                                  }
                              ],
                              "context": "this is an answer one. this is a context one"
                          }, {
                              "qas": [
                                  {
                                      "question": "this is a question two",
                                      "id": "12346",
                                      "answers": [{"text": "this is an answer two", "answer_start": 0}],
                                      "is_impossible": false
                                  }
                              ],
                              "context": "this is an answer two. this is a context two"
                          }
                      ]
                  }, {
                      "title": "ExampleSet2",
                      "paragraphs": [
                          {
                              "qas": [
                                  {
                                      "question": "this is a question three",
                                      "id": "12347",
                                      "answers": [{"text": "this is an answer three", "answer_start": 0}],
                                      "is_impossible": false
                                  }
                              ],
                              "context": "this is an answer three. this is a context three"
                          }, {
                              "qas": [
                                  {
                                      "question": "this is a question four",
                                      "id": "12348",
                                      "answers": [{"text": "this is an answer four", "answer_start": 0}],
                                      "is_impossible": false
                                  }
                              ],
                              "context": "this is an answer four. this is a context four"
                          }
                      ]
                  }
              ]
          }
  
  
      The file ``predict_data.json`` contains the following:
  
      .. code-block::
  
          {
              "version": "v2.0",
              "data": [
                  {
                      "title": "ExampleSet3",
                      "paragraphs": [
                          {
                              "qas": [
                                  {
                                      "question": "this is a question five",
                                      "id": "12349",
                                      "is_impossible": false
                                  }
                              ],
                              "context": "this is an answer five. this is a context five"
                          }, {
                              "qas": [
                                  {
                                      "question": "this is a question six",
                                      "id": "12350",
                                      "is_impossible": false
                                  }
                              ],
                              "context": "this is an answer six. this is a context six"
                          }
                      ]
                  }
              ]
          }
  
      .. doctest::
  
          >>> from flash import Trainer
          >>> from flash.text import QuestionAnsweringData, QuestionAnsweringTask
          >>> datamodule = QuestionAnsweringData.from_squad_v2(
          ...     train_file="train_data.json",
          ...     predict_file="predict_data.json",
          ...     batch_size=2,
          ... )  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          >>> model = QuestionAnsweringTask(max_source_length=32, max_target_length=32)
          >>> trainer = Trainer(fast_dev_run=True)
          >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Training...
          >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Predicting...
  
      .. testcleanup::
  
          >>> import os
          >>> os.remove("train_data.json")
          >>> os.remove("predict_data.json")
  
      """
  
      ds_kw = {
          "question_column_name": question_column_name,
          "context_column_name": context_column_name,
          "answer_column_name": answer_column_name,
      }
  
      return cls(
          input_cls(RunningStage.TRAINING, train_file, **ds_kw),
          input_cls(RunningStage.VALIDATING, val_file, **ds_kw),
          input_cls(RunningStage.TESTING, test_file, **ds_kw),
          input_cls(RunningStage.PREDICTING, predict_file, **ds_kw),
          transform=transform,
          transform_kwargs=transform_kwargs,
          **data_module_kwargs,
      )
  
file_path: lightning-flash/src/flash/text/question_answering/data.py
imports: from typing import Any, Dict, Optional, Type
  from flash.core.data.data_module import DataModule
  from flash.core.data.io.input import Input
  from flash.core.data.io.input_transform import InputTransform
  from flash.core.data.utilities.paths import PATH_TYPE
  from flash.core.utilities.imports import _TOPIC_TEXT_AVAILABLE
  from flash.core.utilities.stages import RunningStage
  from flash.core.utilities.types import INPUT_TRANSFORM_TYPE
  from flash.text.question_answering.input import QuestionAnsweringCSVInput, QuestionAnsweringDictionaryInput, QuestionAnsweringJSONInput, QuestionAnsweringSQuADInput
label_desc: Use image node_id 3 for calling the QuestionAnsweringData obj's underlying member method code with example usage: obj.from_squad_v2(cls, train_file, val_file, test_file, predict_file, input_cls, transform, transform_kwargs, question_column_name, context_column_name, answer_column_name) and returns: cls