class_docstr: BertForQuestionAnswering can load BERT Models with a span classification head on top for extractive
  question-answering tasks like SQuAD (a linear layer on top of the hidden-states output to compute span start
  logits and span end logits).
  
  Pretrained models can be loaded with :meth:`.pretrained` of the companion
  object:
  
  >>> spanClassifier = BertForQuestionAnswering.pretrained() \
  ...     .setInputCols(["document_question", "document_context"]) \
  ...     .setOutputCol("answer")
  
  The default model is ``"bert_base_cased_qa_squad2"``, if no name is
  provided.
  
  For available pretrained models please see the `Models Hub
  <https://sparknlp.org/models?task=Question+Answering>`__.
  
  To see which models are compatible and how to import them see
  `Import Transformers into Spark NLP 🚀
  <https://github.com/JohnSnowLabs/spark-nlp/discussions/5669>`_.
  
  ====================== ======================
  Input Annotation types Output Annotation type
  ====================== ======================
  ``DOCUMENT, DOCUMENT``    ``CHUNK``
  ====================== ======================
  
  Parameters
  ----------
  batchSize
      Batch size. Large values allows faster processing but requires more
      memory, by default 8
  caseSensitive
      Whether to ignore case in tokens for embeddings matching, by default
      False
  configProtoBytes
      ConfigProto from tensorflow, serialized into byte array.
  maxSentenceLength
      Max sentence length to process, by default 128
  
  Examples
  --------
  >>> import sparknlp
  >>> from sparknlp.base import *
  >>> from sparknlp.annotator import *
  >>> from pyspark.ml import Pipeline
  >>> documentAssembler = MultiDocumentAssembler() \
  ...     .setInputCols(["question", "context"]) \
  ...     .setOutputCols(["document_question", "document_context"])
  >>> questionAnswering = BertForQuestionAnswering.pretrained() \
  ...     .setInputCols(["document_question", "document_context"]) \
  ...     .setOutputCol("answer") \
  ...     .setCaseSensitive(False)
  >>> pipeline = Pipeline().setStages([
  ...     documentAssembler,
  ...     questionAnswering
  ... ])
  >>> data = spark.createDataFrame([["What's my name?", "My name is Clara and I live in Berkeley."]]).toDF("question", "context")
  >>> result = pipeline.fit(data).transform(data)
  >>> result.select("answer.result").show(truncate=False)
  +--------------------+
  |result              |
  +--------------------+
  |[Clara]             |
  +--------------------+
class_docstr_tok: ["BertForQuestionAnswering","can","load","BERT","Models","with","a","span","classification","head","on","top","for","extractive","question-answering","tasks","like","SQuAD","(","a","linear","layer","on","top","of","the","hidden-states","output","to","compute","span","start","logits","and","span","end","logits",")",".","Pretrained","models","can","be","loaded","with",":","meth",":","`",".pretrained","`","of","the","companion","object",":",">",">",">","spanClassifier","=","BertForQuestionAnswering.pretrained","(",")","\\","...",".setInputCols","(","[","``","document_question","''",",","``","document_context","''","]",")","\\","...",".setOutputCol","(","``","answer","''",")","The","default","model","is","``","``","bert_base_cased_qa_squad2","''","``",",","if","no","name","is","provided",".","For","available","pretrained","models","please","see","the","`","Models","Hub","<","https",":","\/\/sparknlp.org\/models","?","task=Question+Answering",">","`","__",".","To","see","which","models","are","compatible","and","how","to","import","them","see","`","Import","Transformers","into","Spark","NLP","\ud83d\ude80","<","https",":","\/\/github.com\/JohnSnowLabs\/spark-nlp\/discussions\/5669",">","`","_",".","======================","======================","Input","Annotation","types","Output","Annotation","type","======================","======================","``","DOCUMENT",",","DOCUMENT","``","``","CHUNK","``","======================","======================","Parameters","--","--","--","--","--","batchSize","Batch","size",".","Large","values","allows","faster","processing","but","requires","more","memory",",","by","default","8","caseSensitive","Whether","to","ignore","case","in","tokens","for","embeddings","matching",",","by","default","False","configProtoBytes","ConfigProto","from","tensorflow",",","serialized","into","byte","array",".","maxSentenceLength","Max","sentence","length","to","process",",","by","default","128","Examples","--","--","--","--",">",">",">","import","sparknlp",">",">",">","from","sparknlp.base","import","*",">",">",">","from","sparknlp.annotator","import","*",">",">",">","from","pyspark.ml","import","Pipeline",">",">",">","documentAssembler","=","MultiDocumentAssembler","(",")","\\","...",".setInputCols","(","[","``","question","''",",","``","context","''","]",")","\\","...",".setOutputCols","(","[","``","document_question","''",",","``","document_context","''","]",")",">",">",">","questionAnswering","=","BertForQuestionAnswering.pretrained","(",")","\\","...",".setInputCols","(","[","``","document_question","''",",","``","document_context","''","]",")","\\","...",".setOutputCol","(","``","answer","''",")","\\","...",".setCaseSensitive","(","False",")",">",">",">","pipeline","=","Pipeline","(",")",".setStages","(","[","...","documentAssembler",",","...","questionAnswering","...","]",")",">",">",">","data","=","spark.createDataFrame","(","[","[","``","What","'s","my","name","?","``",",","``","My","name","is","Clara","and","I","live","in","Berkeley",".","``","]","]",")",".toDF","(","``","question","''",",","``","context","''",")",">",">",">","result","=","pipeline.fit","(","data",")",".transform","(","data",")",">",">",">","result.select","(","``","answer.result","''",")",".show","(","truncate=False",")","+","--","--","--","--","--","--","--","--","--","--","+","|result","|","+","--","--","--","--","--","--","--","--","--","--","+","|","[","Clara","]","|","+","--","--","--","--","--","--","--","--","--","--","+"]
docstr: Downloads and loads a pretrained model.
  
  Parameters
  ----------
  name : str, optional
      Name of the pretrained model, by default
      "bert_base_cased_qa_squad2"
  lang : str, optional
      Language of the pretrained model, by default "en"
  remote_loc : str, optional
      Optional remote address of the resource, by default None. Will use
      Spark NLPs repositories otherwise.
  
  Returns
  -------
  BertForQuestionAnswering
      The restored model
docstr_tok: ["Downloads","and","loads","a","pretrained","model",".","Parameters","--","--","--","--","--","name",":","str",",","optional","Name","of","the","pretrained","model",",","by","default","``","bert_base_cased_qa_squad2","''","lang",":","str",",","optional","Language","of","the","pretrained","model",",","by","default","``","en","''","remote_loc",":","str",",","optional","Optional","remote","address","of","the","resource",",","by","default","None",".","Will","use","Spark","NLPs","repositories","otherwise",".","Returns","--","--","--","-","BertForQuestionAnswering","The","restored","model"]
code: def pretrained(
      name="bert_base_cased_qa_squad2", lang="en", remote_loc=None
  ):
      """Downloads and loads a pretrained model.
  
      Parameters
      ----------
      name : str, optional
          Name of the pretrained model, by default
          "bert_base_cased_qa_squad2"
      lang : str, optional
          Language of the pretrained model, by default "en"
      remote_loc : str, optional
          Optional remote address of the resource, by default None. Will use
          Spark NLPs repositories otherwise.
  
      Returns
      -------
      BertForQuestionAnswering
          The restored model
      """
      from sparknlp.pretrained import ResourceDownloader
  
      return ResourceDownloader.downloadModel(
          BertForQuestionAnswering, name, lang, remote_loc
      )
  
file_path: spark-nlp/python/sparknlp/annotator/classifier_dl/bert_for_question_answering.py
imports: from sparknlp.common import *
label_desc: Use image node_id 4 for calling the BertForQuestionAnswering obj's underlying member method code with example usage: obj.pretrained(name, lang, remote_loc) and returns: ResourceDownloader