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: Serialize this component to a dictionary.
docstr_tok: ["Serialize","this","component","to","a","dictionary","."]
code: def to_dict(self) -> Dict[str, Any]:
      """
      Serialize this component to a dictionary.
      """
      serialization_dict = default_to_dict(
          self,
          model=self.model_name_or_path,
          device=self.device,
          token=self.token if not isinstance(self.token, str) else None,
          max_seq_length=self.max_seq_length,
          top_k=self.top_k,
          score_threshold=self.score_threshold,
          stride=self.stride,
          max_batch_size=self.max_batch_size,
          answers_per_seq=self.answers_per_seq,
          no_answer=self.no_answer,
          calibration_factor=self.calibration_factor,
          model_kwargs=self.model_kwargs,
      )
  
      # convert torch.dtype to string for serialization
      # 1. torch_dtype and bnb_4bit_compute_dtype can be specified in model_kwargs
      model_kwargs = serialization_dict["init_parameters"][
          "model_kwargs"
      ]
      for key, value in model_kwargs.items():
          if key in [
              "torch_dtype",
              "bnb_4bit_compute_dtype",
          ] and isinstance(value, torch.dtype):
              serialization_dict["init_parameters"]["model_kwargs"][
                  key
              ] = str(value)
      # 2. bnb_4bit_compute_dtype can be specified in model_kwargs["quantization_config"]
      quantization_config = model_kwargs.get("quantization_config", {})
      bnb_4bit_compute_dtype = quantization_config.get(
          "bnb_4bit_compute_dtype", None
      )
      if isinstance(bnb_4bit_compute_dtype, torch.dtype):
          serialization_dict["init_parameters"]["model_kwargs"][
              "quantization_config"
          ]["bnb_4bit_compute_dtype"] = str(bnb_4bit_compute_dtype)
  
      return serialization_dict
  
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 3 for calling the ExtractiveReader obj's underlying member method code with example usage: obj.to_dict() and returns: serialization_dict