Add model card
Browse files
README.md
CHANGED
|
@@ -1,55 +1,76 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
license: apache-2.0
|
| 4 |
-
base_model: google-bert/bert-base-cased
|
| 5 |
tags:
|
| 6 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
model-index:
|
| 8 |
-
- name: Question_Answering
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
| 13 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
##
|
| 28 |
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
| 36 |
-
- learning_rate: 2e-05
|
| 37 |
-
- train_batch_size: 16
|
| 38 |
-
- eval_batch_size: 16
|
| 39 |
-
- seed: 42
|
| 40 |
-
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 41 |
-
- lr_scheduler_type: linear
|
| 42 |
-
- lr_scheduler_warmup_steps: 0.1
|
| 43 |
-
- num_epochs: 3
|
| 44 |
-
- mixed_precision_training: Native AMP
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
+
- question-answering
|
| 5 |
+
- bert
|
| 6 |
+
- squad
|
| 7 |
+
- extractive-qa
|
| 8 |
+
datasets:
|
| 9 |
+
- squad
|
| 10 |
+
metrics:
|
| 11 |
+
- exact_match
|
| 12 |
+
- f1
|
| 13 |
model-index:
|
| 14 |
+
- name: Question_Answering
|
| 15 |
+
results:
|
| 16 |
+
- task:
|
| 17 |
+
type: question-answering
|
| 18 |
+
dataset:
|
| 19 |
+
name: SQuAD v1.1
|
| 20 |
+
type: squad
|
| 21 |
+
metrics:
|
| 22 |
+
- type: exact_match
|
| 23 |
+
value: 81.0501
|
| 24 |
+
- type: f1
|
| 25 |
+
value: 88.5526
|
| 26 |
---
|
| 27 |
|
| 28 |
+
# BERT Fine-Tuned on SQuAD (Extractive Question Answering)
|
|
|
|
| 29 |
|
| 30 |
+
This model extracts answers to questions directly from a provided text passage.
|
| 31 |
+
It was fine-tuned from `bert-base-cased` on the SQuAD v1.1 dataset.
|
| 32 |
|
| 33 |
+
## How It Works
|
| 34 |
|
| 35 |
+
Given a **context** (a paragraph of text) and a **question**, the model finds
|
| 36 |
+
and returns the exact span of text in the context that answers the question.
|
| 37 |
|
| 38 |
+
## Performance
|
| 39 |
|
| 40 |
+
| Metric | Score |
|
| 41 |
+
|--------|-------|
|
| 42 |
+
| Exact Match | 81.05% |
|
| 43 |
+
| F1 Score | 88.55% |
|
| 44 |
|
| 45 |
+
*(Evaluated on SQuAD v1.1 validation set — 10,570 examples)*
|
| 46 |
|
| 47 |
+
## How to Use
|
| 48 |
|
| 49 |
+
```python
|
| 50 |
+
from transformers import pipeline
|
| 51 |
|
| 52 |
+
qa = pipeline(
|
| 53 |
+
"question-answering",
|
| 54 |
+
model="samandar1105/Question_Answering"
|
| 55 |
+
)
|
| 56 |
|
| 57 |
+
result = qa(
|
| 58 |
+
question="Who designed the Eiffel Tower?",
|
| 59 |
+
context="The Eiffel Tower was designed by Gustave Eiffel and built between 1887 and 1889 in Paris."
|
| 60 |
+
)
|
| 61 |
+
print(result)
|
| 62 |
+
# {'answer': 'Gustave Eiffel', 'score': 0.99, 'start': 31, 'end': 45}
|
| 63 |
+
```
|
| 64 |
|
| 65 |
+
## Training Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
| Parameter | Value |
|
| 68 |
+
|-----------|-------|
|
| 69 |
+
| Base model | bert-base-cased |
|
| 70 |
+
| Dataset | SQuAD v1.1 (87,599 train / 10,570 val) |
|
| 71 |
+
| Learning rate | 2e-5 |
|
| 72 |
+
| Epochs | 3 |
|
| 73 |
+
| Batch size | 16 |
|
| 74 |
+
| Max sequence length | 384 |
|
| 75 |
+
| Stride | 128 |
|
| 76 |
+
| Framework | PyTorch + HuggingFace Transformers |
|