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