Dense Passage Retrieval (DPR) model for open-domain question answering using contrastive loss between question and passage encoders.
configs/
: YAML configuration files for training DPR models.model.py
: Defines the DPR model architecture including question and passage encoders.run.py
: Script for training DPR on Cerebras systems or GPU.utils.py
: Utilities for config parsing and distributed training support.Configuration | Description |
---|---|
params_dpr_base_nq.yaml | Base DPR configuration trained on the Natural Questions dataset. |
Input Name | Shape | Data Type | Description |
---|---|---|---|
questions_input_ids | (batch_size, max_seq_len) | torch.int32 | Token IDs for the input questions. |
questions_attention_mask | (batch_size, max_seq_len) | torch.int32 | Attention mask for question tokens. |
questions_token_type_ids | (batch_size, max_seq_len) | torch.int32 | Token type IDs for questions (typically all zeros). |
ctx_input_ids | (batch_size, 2, max_seq_len) | torch.int32 | Token IDs for one positive and one hard-negative passage per question. |
ctx_attention_mask | (batch_size, 2, max_seq_len) | torch.int32 | Attention mask for the passage tokens. |
ctx_token_type_ids | (batch_size, 2, max_seq_len) | torch.int32 | Token type IDs for passages (typically all zeros). |