Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
tags:
|
| 5 |
+
- Pre-CoFactv3
|
| 6 |
+
- Question Answering
|
| 7 |
+
datasets:
|
| 8 |
+
- FACTIFY5WQA
|
| 9 |
+
metrics:
|
| 10 |
+
- bleu
|
| 11 |
+
pipeline_tag: question-answering
|
| 12 |
+
library_name: transformers
|
| 13 |
+
base_model: microsoft/deberta-v3-large
|
| 14 |
+
widget:
|
| 15 |
+
- text: "Who spent an entire season at aston vila without playing a single game?"
|
| 16 |
+
context: "Micah Richards spent an entire season at Aston Vila without playing a single game."
|
| 17 |
+
example_title: "Claim"
|
| 18 |
+
- text: "Who spent an entire season at aston vila without playing a single game?"
|
| 19 |
+
context: "Despite speculation that Richards would leave Aston Villa before the transfer deadline for the 2018~19 season , he remained at the club , although he is not being considered for first team selection."
|
| 20 |
+
example_title: "Evidence"
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# Pre-CoFactv3-Question-Answering
|
| 24 |
+
|
| 25 |
+
## Model description
|
| 26 |
+
|
| 27 |
+
This is a Question Answering model for **AAAI 2024 Workshop Paper: “Team Trifecta at Factify5WQA: Setting the Standard in Fact Verification with Fine-Tuning”**
|
| 28 |
+
|
| 29 |
+
Its input are question and context, and output is the answers derived from the context. It is fine-tuned by **FACTIFY5WQA** dataset based on [**microsoft/deberta-v3-large**](https://huggingface.co/microsoft/deberta-v3-large) model.
|
| 30 |
+
|
| 31 |
+
For more details, you can see our **paper** or [**GitHub**](https://github.com/AndyChiangSH/Pre-CoFactv3).
|
| 32 |
+
|
| 33 |
+
## How to use?
|
| 34 |
+
|
| 35 |
+
1. Download the model by hugging face transformers.
|
| 36 |
+
```python
|
| 37 |
+
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 38 |
+
|
| 39 |
+
model = AutoModelForQuestionAnswering.from_pretrained("AndyChiang/Pre-CoFactv3-Question-Answering")
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained("AndyChiang/Pre-CoFactv3-Question-Answering")
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
2. Create a pipeline.
|
| 44 |
+
```python
|
| 45 |
+
QA = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
3. Use the pipeline to answer the question by context.
|
| 49 |
+
```python
|
| 50 |
+
QA_input = {
|
| 51 |
+
'context': "Micah Richards spent an entire season at Aston Vila without playing a single game.",
|
| 52 |
+
'question': "Who spent an entire season at aston vila without playing a single game?",
|
| 53 |
+
}
|
| 54 |
+
answer = QA(QA_input)
|
| 55 |
+
print(answer)
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Dataset
|
| 59 |
+
|
| 60 |
+
We utilize the dataset FACTIFY5WQA provided by the AAAI-24 Workshop Factify 3.0.
|
| 61 |
+
|
| 62 |
+
This dataset is designed for fact verification, with the task of determining the veracity of a claim based on the given evidence.
|
| 63 |
+
|
| 64 |
+
- **claim:** the statement to be verified.
|
| 65 |
+
- **evidence:** the facts to verify the claim.
|
| 66 |
+
- **question:** the questions generated from the claim by the 5W framework (who, what, when, where, and why).
|
| 67 |
+
- **claim_answer:** the answers derived from the claim.
|
| 68 |
+
- **evidence_answer:** the answers derived from the evidence.
|
| 69 |
+
- **label:** the veracity of the claim based on the given evidence, which is one of three categories: Support, Neutral, or Refute.
|
| 70 |
+
|
| 71 |
+
| | Training | Validation | Testing | Total |
|
| 72 |
+
| --- | --- | --- | --- | --- |
|
| 73 |
+
| Support | 3500 | 750 | 750 | 5000 |
|
| 74 |
+
| Neutral | 3500 | 750 | 750 | 5000 |
|
| 75 |
+
| Refute | 3500 | 750 | 750 | 5000 |
|
| 76 |
+
| Total | 10500 | 2250 | 2250 | 15000 |
|
| 77 |
+
|
| 78 |
+
## Fine-tuning
|
| 79 |
+
|
| 80 |
+
Fine-tuning is conducted by the Hugging Face Trainer API on the [Question Answering](https://huggingface.co/docs/transformers/tasks/question_answering) task.
|
| 81 |
+
|
| 82 |
+
### Training hyperparameters
|
| 83 |
+
|
| 84 |
+
The following hyperparameters were used during training:
|
| 85 |
+
|
| 86 |
+
- Pre-train language model: [microsoft/deberta-v3-large](https://huggingface.co/microsoft/deberta-v3-large)
|
| 87 |
+
- Optimizer: adam
|
| 88 |
+
- Learning rate: 0.00001
|
| 89 |
+
- Max length of input: 3200
|
| 90 |
+
- Batch size: 4
|
| 91 |
+
- Epoch: 3
|
| 92 |
+
- Device: NVIDIA RTX A5000
|
| 93 |
+
|
| 94 |
+
## Testing
|
| 95 |
+
|
| 96 |
+
We employ BLEU scores for both claim answer and evidence answer, taking the average of the two as the metric.
|
| 97 |
+
|
| 98 |
+
| Claim Answer | Evidence Answer | Average |
|
| 99 |
+
| ----- | ----- | ----- |
|
| 100 |
+
| 0.5248 | 0.3963 | 0.4605 |
|
| 101 |
+
|
| 102 |
+
## Other models
|
| 103 |
+
|
| 104 |
+
[AndyChiang/Pre-CoFactv3-Text-Classification](https://huggingface.co/AndyChiang/Pre-CoFactv3-Text-Classification)
|
| 105 |
+
|
| 106 |
+
## Citation
|