Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: bert-base-uncased
|
| 4 |
+
tags: [dpr, retrieval, rag]
|
| 5 |
+
---
|
| 6 |
+
# rag-assign-dpr
|
| 7 |
+
|
| 8 |
+
2026-2 RAG ๊ณผ์ ์ฉ DPR bi-encoder. `bert-base-uncased` ์์ ์์ํด **๊ณผ์ ์ ๊ณต ๋ฐ์ดํฐ(train_qa + train_qrels)๋ง์ผ๋ก** ํ์ต (๊ณต๊ฐ DPR ๊ฐ์ค์น ๋ฏธ์ฌ์ฉ).
|
| 9 |
+
BM25 ์์ 100 ํ๋ณด๋ฅผ ์ฌ์ ๋ ฌํ๋ ์ฉ๋.
|
| 10 |
+
|
| 11 |
+
- `question_encoder/`, `ctx_encoder/` (transformers `DPRQuestionEncoder` / `DPRContextEncoder`)
|
| 12 |
+
- ํ์ต: ์ง๋ฌธ๋ง๋ค gold 1 + qrels hard_neg 1 (์ ๋ต ๋ฌธ์์ด ํฌํจ hard_neg 7341๊ฐ ์ ์ธ) + in-batch negative, cross-entropy
|
| 13 |
+
- ํ์ต ์ง๋ฌธ 57880๊ฐ (train_qa ์ค `random.Random(0).sample(train_qa, 1000)` ์ val ๋ก ์ ์ธ)
|
| 14 |
+
- best epoch: 10 (val gold/weak_pos@5 โ gold MRR ๊ธฐ์ค), ํ์ต GPU: RTX 3080 (bf16 autocast), epoch ๋น ์ฝ 11๋ถ
|
| 15 |
+
|
| 16 |
+
| hyperparameter | value |
|
| 17 |
+
|---|---|
|
| 18 |
+
| epochs | 10 |
|
| 19 |
+
| lr | 2e-05 |
|
| 20 |
+
| batch_size | 64 |
|
| 21 |
+
| max_q_len | 64 |
|
| 22 |
+
| max_p_len | 256 |
|
| 23 |
+
| warmup_ratio | 0.1 |
|
| 24 |
+
| weight_decay | 0.0 |
|
| 25 |
+
| grad_clip | 2.0 |
|
| 26 |
+
| seed | 42 |
|
| 27 |
+
| grad_ckpt | True |
|
| 28 |
+
|
| 29 |
+
epoch ๋ณ val ๊ธฐ๋ก: `history.json`
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from transformers import AutoTokenizer, DPRQuestionEncoder, DPRContextEncoder
|
| 33 |
+
q = DPRQuestionEncoder.from_pretrained("yali98/rag-assign-dpr", subfolder="question_encoder")
|
| 34 |
+
c = DPRContextEncoder.from_pretrained("yali98/rag-assign-dpr", subfolder="ctx_encoder")
|
| 35 |
+
tok = AutoTokenizer.from_pretrained("yali98/rag-assign-dpr", subfolder="question_encoder")
|
| 36 |
+
```
|