readme: ---
  language: en
  license: cc-by-nc-4.0
  tags:
  - dpr
  datasets:
  - nq_open
  inference: false
  ---
  
  `dpr-reader-single-nq-base`
  
  # Table of Contents
  - [Model Details](#model-details)
  - [How To Get Started With the Model](#how-to-get-started-with-the-model)
  - [Uses](#uses)
  - [Risks, Limitations and Biases](#risks-limitations-and-biases)
  - [Training](#training)
  - [Evaluation](#evaluation-results)
  - [Environmental Impact](#environmental-impact)
  - [Technical Specifications](#technical-specifications)
  - [Citation Information](#citation-information)
  - [Model Card Authors](#model-card-authors)
  
  ## Model Details
  
  **Model Description:** [Dense Passage Retrieval (DPR)](https://github.com/facebookresearch/DPR) is a set of tools and models for state-of-the-art open-domain Q&A research. `dpr-reader-single-nq-base` is the reader model trained using the [Natural Questions (NQ) dataset](https://huggingface.co/datasets/nq_open) ([Lee et al., 2019](https://aclanthology.org/P19-1612/); [Kwiatkowski et al., 2019](https://aclanthology.org/Q19-1026/)).
  
  - **Developed by:** See [GitHub repo](https://github.com/facebookresearch/DPR) for model developers  
  - **Model Type:** QA Reader Model
  - **Language(s):** [CC-BY-NC-4.0](https://github.com/facebookresearch/DPR/blob/main/LICENSE), also see [Code of Conduct](https://github.com/facebookresearch/DPR/blob/main/CODE_OF_CONDUCT.md)
  - **License:** English
  - **Related Models:** 
    - [`dpr-ctx_encoder-single-nq-base`](https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base)
    - [`dpr-question_encoder-single-nq-base`](https://huggingface.co/facebook/dpr-question_encoder-single-nq-base)
    - [`dpr-ctx_encoder-multiset-base`](https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base)
    - [`dpr-question_encoder-multiset-base`](https://huggingface.co/facebook/dpr-question_encoder-multiset-base)
    - [`dpr-reader-multiset-base`](https://huggingface.co/facebook/dpr-reader-multiset-base)
  - **Resources for more information:**
    - [Research Paper](https://arxiv.org/abs/2004.04906)
    - [GitHub Repo](https://github.com/facebookresearch/DPR)
    - [Hugging Face DPR docs](https://huggingface.co/docs/transformers/main/en/model_doc/dpr)
    - [BERT Base Uncased Model Card](https://huggingface.co/bert-base-uncased)
    
  ## How to Get Started with the Model 
  
  Use the code below to get started with the model. 
  
  ```python
  from transformers import DPRReader, DPRReaderTokenizer
  
  tokenizer = DPRReaderTokenizer.from_pretrained("facebook/dpr-reader-single-nq-base")
  model = DPRReader.from_pretrained("facebook/dpr-reader-single-nq-base")
  encoded_inputs = tokenizer(
      questions=["What is love ?"],
      titles=["Haddaway"],
      texts=["'What Is Love' is a song recorded by the artist Haddaway"],
      return_tensors="pt",
  )
  outputs = model(**encoded_inputs)
  start_logits = outputs.start_logits
  end_logits = outputs.end_logits
  relevance_logits = outputs.relevance_logits
  ```
  
  ## Uses
  
  #### Direct Use
  
  `dpr-reader-single-nq-base`, [`dpr-ctx_encoder-single-nq-base`](https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base), and [`dpr-question_encoder-single-nq-base`](https://huggingface.co/facebook/dpr-question_encoder-single-nq-base) can be used for the task of open-domain question answering.
  
  #### Misuse and Out-of-scope Use
  
  The model should not be used to intentionally create hostile or alienating environments for people. In addition, the set of DPR models was not trained to be factual or true representations of people or events, and therefore using the models to generate such content is out-of-scope for the abilities of this model.
  
  ## Risks, Limitations and Biases
  
  **CONTENT WARNING: Readers should be aware this section may contain content that is disturbing, offensive, and can propogate historical and current stereotypes.**
  
  Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al., 2021](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al., 2021](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model can include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups. 
  
  ## Training
  
  #### Training Data
  
  This model was trained using the [Natural Questions (NQ) dataset](https://huggingface.co/datasets/nq_open) ([Lee et al., 2019](https://aclanthology.org/P19-1612/); [Kwiatkowski et al., 2019](https://aclanthology.org/Q19-1026/)). The model authors write that: 
  
  > [The dataset] was designed for end-to-end question answering. The questions were mined from real Google search queries and the answers were spans in Wikipedia articles identified by annotators.
  
  #### Training Procedure
  
  The training procedure is described in the [associated paper](https://arxiv.org/pdf/2004.04906.pdf): 
  
  > Given a collection of M text passages, the goal of our dense passage retriever (DPR) is to index all the passages in a low-dimensional and continuous space, such that it