class_docstr: A component that locates and extract answers to a given query from Documents. It's used for performing extractive
  QA. The Reader assigns a score to every possible answer span independently of other answer spans.
  This fixes a common issue of other implementations which make comparisons across documents harder by normalizing
  each document's answers independently.
  
  Example usage:
  ```python
  p = Pipeline()
  p.add_component(instance=InMemoryBM25Retriever(document_store=InMemoryDocumentStore()), name="retriever")
  p.add_component(instance=ExtractiveReader(), name="reader")
  p.connect("retriever", "reader")
  question = "Who lives in Berlin?"
  p.run({"retriever": {"query": question}, "reader": {"query": question}})
  ```
docstr: Creates an ExtractiveReader
  :param model: A Hugging Face transformers question answering model.
      Can either be a path to a folder containing the model files or an identifier for the Hugging Face hub.
      Default: `'deepset/roberta-base-squad2-distilled'`
  :param device: Pytorch device string. Uses GPU by default, if available.
  :param token: The API token used to download private models from Hugging Face.
      If this parameter is set to `True`, then the token generated when running
      `transformers-cli login` (stored in ~/.huggingface) is used.
  :param top_k: Number of answers to return per query.
      It is required even if score_threshold is set. Defaults to 20.
      An additional answer with no text is returned if no_answer is set to True (default).
  :param score_threshold: Returns only answers with the probability score above this threshold.
  :param max_seq_length: Maximum number of tokens.
      If a sequence exceeds it, the sequence is split.
      Default: 384
  :param stride: Number of tokens that overlap when sequence is split because it exceeds max_seq_length.
      Default: 128
  :param max_batch_size: Maximum number of samples that are fed through the model at the same time.
  :param answers_per_seq: Number of answer candidates to consider per sequence.
      This is relevant when a Document was split into multiple sequences because of max_seq_length.
  :param no_answer: Whether to return an additional `no answer` with an empty text and a score representing the
      probability that the other top_k answers are incorrect.
  :param calibration_factor: Factor used for calibrating probabilities.
  :param overlap_threshold: If set this will remove duplicate answers if they have an overlap larger than the
      supplied threshold. For example, for the answers "in the river in Maine" and "the river" we would remove
      one of these answers since the second answer has a 100% (1.0) overlap with the first answer.
      However, for the answers "the river in" and "in Maine" there is only a max overlap percentage of 25% so
      both of these answers could be kept if this variable is set to 0.24 or lower.
      If None is provided then all answers are kept.
  :param model_kwargs: Additional keyword arguments passed to `AutoModelForQuestionAnswering.from_pretrained`
      when loading the model specified in `model`. For details on what kwargs you can pass,
      see the model's documentation.
docstr_tok: ["Creates","an","ExtractiveReader",":","param","model",":","A","Hugging","Face","transformers","question","answering","model",".","Can","either","be","a","path","to","a","folder","containing","the","model","files","or","an","identifier","for","the","Hugging","Face","hub",".","Default",":","`","'deepset\/roberta-base-squad2-distilled","'","`",":","param","device",":","Pytorch","device","string",".","Uses","GPU","by","default",",","if","available",".",":","param","token",":","The","API","token","used","to","download","private","models","from","Hugging","Face",".","If","this","parameter","is","set","to","`","True","`",",","then","the","token","generated","when","running","`","transformers-cli","login","`","(","stored","in","~\/.huggingface",")","is","used",".",":","param","top_k",":","Number","of","answers","to","return","per","query",".","It","is","required","even","if","score_threshold","is","set",".","Defaults","to","20",".","An","additional","answer","with","no","text","is","returned","if","no_answer","is","set","to","True","(","default",")",".",":","param","score_threshold",":","Returns","only","answers","with","the","probability","score","above","this","threshold",".",":","param","max_seq_length",":","Maximum","number","of","tokens",".","If","a","sequence","exceeds","it",",","the","sequence","is","split",".","Default",":","384",":","param","stride",":","Number","of","tokens","that","overlap","when","sequence","is","split","because","it","exceeds","max_seq_length",".","Default",":","128",":","param","max_batch_size",":","Maximum","number","of","samples","that","are","fed","through","the","model","at","the","same","time",".",":","param","answers_per_seq",":","Number","of","answer","candidates","to","consider","per","sequence",".","This","is","relevant","when","a","Document","was","split","into","multiple","sequences","because","of","max_seq_length",".",":","param","no_answer",":","Whether","to","return","an","additional","`","no","answer","`","with","an","empty","text","and","a","score","representing","the","probability","that","the","other","top_k","answers","are","incorrect",".",":","param","calibration_factor",":","Factor","used","for","calibrating","probabilities",".",":","param","overlap_threshold",":","If","set","this","will","remove","duplicate","answers","if","they","have","an","overlap","larger","than","the","supplied","threshold",".","For","example",",","for","the","answers","``","in","the","river","in","Maine","''","and","``","the","river","''","we","would","remove","one","of","these","answers","since","the","second","answer","has","a","100","%","(","1.0",")","overlap","with","the","first","answer",".","However",",","for","the","answers","``","the","river","in","''","and","``","in","Maine","''","there","is","only","a","max","overlap","percentage","of","25","%","so","both","of","these","answers","could","be","kept","if","this","variable","is","set","to","0.24","or","lower",".","If","None","is","provided","then","all","answers","are","kept",".",":","param","model_kwargs",":","Additional","keyword","arguments","passed","to","`","AutoModelForQuestionAnswering.from_pretrained","`","when","loading","the","model","specified","in","`","model","`",".","For","details","on","what","kwargs","you","can","pass",",","see","the","model","'s","documentation","."]
code: def __init__(
      self,
      model: Union[Path, str] = "deepset/roberta-base-squad2-distilled",
      device: Optional[str] = None,
      token: Union[bool, str, None] = None,
      top_k: int = 20,
      score_threshold: Optional[float] = None,
      max_seq_length: int = 384,
      stride: int = 128,
      max_batch_size: Optional[int] = None,
      answers_per_seq: Optional[int] = None,
      no_answer: bool = True,
      calibration_factor: float = 0.1,
      overlap_threshold: Optional[float] = 0.01,
      model_kwargs: Optional[Dict[str, Any]] = None,
  ) -> None:
      """
      Creates an ExtractiveReader
      :param model: A Hugging Face transformers question answering model.
          Can either be a path to a folder containing the model files or an identifier for the Hugging Face hub.
          Default: `'deepset/roberta-base-squad2-distilled'`
      :param device: Pytorch device string. Uses GPU by default, if available.
      :param token: The API token used to download private models from Hugging Face.
          If this parameter is set to `True`, then the token generated when running
          `transformers-cli login` (stored in ~/.huggingface) is used.
      :param top_k: Number of answers to return per query.
          It is required even if score_threshold is set. Defaults to 20.
          An additional answer with no text is returned if no_answer is set to True (default).
      :param score_threshold: Returns only answers with the probability score above this threshold.
      :param max_seq_length: Maximum number of tokens.
          If a sequence exceeds it, the sequence is split.
          Default: 384
      :param stride: Number of tokens that overlap when sequence is split because it exceeds max_seq_length.
          Default: 128
      :param max_batch_size: Maximum number of samples that are fed through the model at the same time.
      :param answers_per_seq: Number of answer candidates to consider per sequence.
          This is relevant when a Document was split into multiple sequences because of max_seq_length.
      :param no_answer: Whether to return an additional `no answer` with an empty text and a score representing the
          probability that the other top_k answers are incorrect.
      :param calibration_factor: Factor used for calibrating probabilities.
      :param overlap_threshold: If set this will remove duplicate answers if they have an overlap larger than the
          supplied threshold. For example, for the answers "in the river in Maine" and "the river" we would remove
          one of these answers since the second answer has a 100% (1.0) overlap with the first answer.
          However, for the answers "the river in" and "in Maine" there is only a max overlap percentage of 25% so
          both of these answers could be kept if this variable is set to 0.24 or lower.
          If None is provided then all answers are kept.
      :param model_kwargs: Additional keyword arguments passed to `AutoModelForQuestionAnswering.from_pretrained`
          when loading the model specified in `model`. For details on what kwargs you can pass,
          see the model's documentation.
      """
      torch_and_transformers_import.check()
      self.model_name_or_path = str(model)
      self.model = None
      self.device = device
      self.token = token
      self.max_seq_length = max_seq_length
      self.top_k = top_k
      self.score_threshold = score_threshold
      self.stride = stride
      self.max_batch_size = max_batch_size
      self.answers_per_seq = answers_per_seq
      self.no_answer = no_answer
      self.calibration_factor = calibration_factor
      self.model_kwargs = model_kwargs or {}
      self.overlap_threshold = overlap_threshold
  
imports: from pathlib import Path
  from typing import Any, Dict, List, Optional, Tuple, Union
  import math
  import warnings
  import logging
  from haystack import component, default_to_dict, default_from_dict, ComponentError, Document, ExtractedAnswer
  from haystack.lazy_imports import LazyImport
  from haystack.utils import get_device
label_desc: Use image node_id 1 to create a new ExtractiveReader object  with example: obj = ExtractiveReader(model, device, token, top_k, score_threshold, max_seq_length, stride, max_batch_size, answers_per_seq, no_answer, calibration_factor, overlap_threshold, model_kwargs)