Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,96 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- vi
|
| 5 |
+
metrics:
|
| 6 |
+
- exact_match
|
| 7 |
+
- f1
|
| 8 |
+
library_name: transformers
|
| 9 |
+
pipeline_tag: question-answering
|
| 10 |
---
|
| 11 |
+
# Model Card for Model ID
|
| 12 |
+
|
| 13 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 14 |
+
|
| 15 |
+
This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).
|
| 16 |
+
|
| 17 |
+
## Model Details
|
| 18 |
+
|
| 19 |
+
### Model Description
|
| 20 |
+
|
| 21 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
- **Developed by:** [Tô Hoàng Minh Tiến]
|
| 26 |
+
- **Finetuned from model [optional]:** [xml-roberta-base]
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
<!-- Provide the basic links for the model. -->
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
## How to Get Started with the Model
|
| 33 |
+
|
| 34 |
+
Use the code below to get started with the model.
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
# Load model directly
|
| 38 |
+
from transformers import AutoTokenizer, TFAutoModelForQuestionAnswering
|
| 39 |
+
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained("Tien-THM/QAVi")
|
| 41 |
+
model = TFAutoModelForQuestionAnswering.from_pretrained("Tien-THM/QAVi")
|
| 42 |
+
|
| 43 |
+
import numpy as np
|
| 44 |
+
|
| 45 |
+
def Inference(context, question):
|
| 46 |
+
encoding = tokenizer(context, question, return_tensors='tf')
|
| 47 |
+
start_pos = model(encoding).start_logits
|
| 48 |
+
end_pos = model(encoding).end_logits
|
| 49 |
+
s = np.argmax(start_pos[0])
|
| 50 |
+
e = np.argmax(end_pos[0])
|
| 51 |
+
print(tokenizer.decode(encoding['input_ids'][0][s:e+1]))
|
| 52 |
+
|
| 53 |
+
question = 'Elon Musk là người nước nào?'
|
| 54 |
+
context = 'Elon Reeve Musk FRS (sinh ngày 28 tháng 6 năm 1971), là một kỹ sư, nhà tài phiệt, nhà phát minh, doanh nhân công nghệ và nhà từ thiện người Mỹ gốc Nam Phi.'
|
| 55 |
+
|
| 56 |
+
Inference(context, question)
|
| 57 |
+
# Answer: người Mỹ gốc Nam Phi
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Training Details
|
| 61 |
+
|
| 62 |
+
### Training Data
|
| 63 |
+
|
| 64 |
+
[using 2 datasets: Zalo Challenge 2022 and XSQUAD Vi]
|
| 65 |
+
|
| 66 |
+
### Training Procedure
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
#### Training Hyperparameters
|
| 70 |
+
* Learning rate: 2e-5
|
| 71 |
+
* Batch size: 16
|
| 72 |
+
* Epoch: 4
|
| 73 |
+
|
| 74 |
+
#### Training Loss
|
| 75 |
+
| Epoch | Train loss | Validation loss | Exact Match |
|
| 76 |
+
|----------|----------|----------|----------|
|
| 77 |
+
| #1 | 3.0424 | 1.3987 | 0.68 |
|
| 78 |
+
| #2 | 0.9563 | 1.2139 | 0.74 |
|
| 79 |
+
| #3 | 0.3920 | 1.4264 | 0.75 |
|
| 80 |
+
| #4 | 0.2175 | 1.4742 | 0.74 |
|
| 81 |
+
I restored the check point in the 2nd epoch
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
## Evaluation
|
| 85 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 86 |
+
|
| 87 |
+
### Testing Data, Factors & Metrics
|
| 88 |
+
|
| 89 |
+
#### Metrics
|
| 90 |
+
|
| 91 |
+
* Exact Match: 0.74
|
| 92 |
+
* F1: 0.84
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|