raihanpf22
commited on
Commit
·
18a682b
1
Parent(s):
63835cf
Upload config
Browse files
readme.md
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- id
|
4 |
+
license: cc-by-4.0
|
5 |
+
library_name: nemo
|
6 |
+
datasets:
|
7 |
+
- SQuAD-indonesian-language-(442-Context-Title)
|
8 |
+
thumbnail: null
|
9 |
+
tags:
|
10 |
+
- natural-language-processing
|
11 |
+
- qna
|
12 |
+
- chatbot
|
13 |
+
- bert
|
14 |
+
- Transformer
|
15 |
+
- NeMo
|
16 |
+
- pytorch
|
17 |
+
model-index:
|
18 |
+
- name: nlp_id_qa_bert_base_uncased
|
19 |
+
results: []
|
20 |
+
|
21 |
+
---
|
22 |
+
|
23 |
+
|
24 |
+
## Model Overview
|
25 |
+
|
26 |
+
This model was built using the NeMo Nvidia BERTQAModel, using the SQuAD v2.0 dataset in Indonesian.
|
27 |
+
|
28 |
+
## NVIDIA NeMo: Training
|
29 |
+
|
30 |
+
To train, fine-tune or play with the model you will need to install [NVIDIA NeMo](https://github.com/NVIDIA/NeMo). We recommend you install it after you've installed latest Pytorch version.
|
31 |
+
```
|
32 |
+
pip install nemo_toolkit['all']
|
33 |
+
```
|
34 |
+
|
35 |
+
## How to Use this Model
|
36 |
+
|
37 |
+
The model is available for use in the NeMo toolkit [3], and can be used as a pre-trained checkpoint for inference or for fine-tuning on another dataset.
|
38 |
+
|
39 |
+
### Automatically instantiate the model
|
40 |
+
|
41 |
+
```python
|
42 |
+
import nemo.collections.nlp as model
|
43 |
+
model = nemo_nlp.models.question_answering.qa_bert_model.BERTQAModel.from_pretrained("raihanpf22/nlp_id_qa_bert_base_uncased")
|
44 |
+
```
|
45 |
+
|
46 |
+
### Transcribing using Python
|
47 |
+
|
48 |
+
Simply do:
|
49 |
+
```
|
50 |
+
eval_device = [config.trainer.devices[0]] if isinstance(config.trainer.devices, list) else 1
|
51 |
+
model.trainer = pl.Trainer(
|
52 |
+
devices=eval_device,
|
53 |
+
accelerator=config.trainer.accelerator,
|
54 |
+
precision=16,
|
55 |
+
logger=False,
|
56 |
+
)
|
57 |
+
|
58 |
+
config.exp_manager.create_checkpoint_callback = False
|
59 |
+
exp_dir = exp_manager(model.trainer, config.exp_manager)
|
60 |
+
output_nbest_file = os.path.join(exp_dir, "output_nbest_file.json")
|
61 |
+
output_prediction_file = os.path.join(exp_dir, "output_prediction_file.json")
|
62 |
+
|
63 |
+
all_preds, all_nbest = model.inference(
|
64 |
+
"questions.json",
|
65 |
+
output_prediction_file=output_prediction_file,
|
66 |
+
output_nbest_file=output_nbest_file,
|
67 |
+
num_samples=-1, # setting to -1 will use all samples for inference
|
68 |
+
)
|
69 |
+
|
70 |
+
for question_id in all_preds:
|
71 |
+
print(all_preds[question_id])
|
72 |
+
```
|
73 |
+
|
74 |
+
### Input
|
75 |
+
|
76 |
+
This model accepts SQuAD Format v2.0 as input.
|
77 |
+
|
78 |
+
### Output
|
79 |
+
|
80 |
+
This model provides output in the form of answers to questions according to the existing context.
|
81 |
+
|
82 |
+
## Model Architecture
|
83 |
+
|
84 |
+
Using an uncased BERT base architecture model.
|
85 |
+
|
86 |
+
## Training
|
87 |
+
|
88 |
+
50 Epochs, 8 Batch size per GPU, 1 num_layer
|
89 |
+
|
90 |
+
### Datasets
|
91 |
+
|
92 |
+
using SQuAD v2.0 as train data
|
93 |
+
|
94 |
+
## Performance
|
95 |
+
|
96 |
+
test_HasAns_exact = 98.0
|
97 |
+
test_HasAns_f1 = 98.0465087890625
|
98 |
+
test_HasAns_total = 100.0
|
99 |
+
test_NoAns_exact = 0.0
|
100 |
+
test_NoAns_f1 = 0.0
|
101 |
+
test_NoAns_total = 0.0
|
102 |
+
test_exact = 98.0
|
103 |
+
test_f1 = 98.0465087890625
|
104 |
+
test_loss = 0.00019806227646768093
|
105 |
+
test_total = 100.0
|
106 |
+
|
107 |
+
## References
|
108 |
+
|
109 |
+
<ADD ANY REFERENCES HERE AS NEEDED>
|
110 |
+
|
111 |
+
[1] [NVIDIA NeMo Toolkit](https://github.com/NVIDIA/NeMo)
|
112 |
+
|