CoolFace
Modelpublic

esakrissa/IndoBERT-SQuAD

sourceHugging Facemitupdated 4y agoView on Hugging Face
3likes14downloads
Model Card

<!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. -->

indobert-squad-trained

This model is a fine-tuned version of indolem/indobert-base-uncased on the None dataset. It achieves the following results on the evaluation set:

  • Loss: 1.8025

IndoBERT

IndoBERT is the Indonesian version of BERT model. We train the model using over 220M words, aggregated from three main sources:

  • Indonesian Wikipedia (74M words)
  • news articles from Kompas, Tempo (Tala et al., 2003), and Liputan6 (55M words in total)
  • an Indonesian Web Corpus (Medved and Suchomel, 2017) (90M words).

We trained the model for 2.4M steps (180 epochs) with the final perplexity over the development set being 3.97 (similar to English BERT-base).

This IndoBERT was used to examine IndoLEM - an Indonesian benchmark that comprises of seven tasks for the Indonesian language, spanning morpho-syntax, semantics, and discourse.

Training and evaluation data

SQuAD2.0 combines the 100,000 questions in SQuAD1.1 with over 50,000 unanswerable questions written adversarially by crowdworkers to look similar to answerable ones. To do well on SQuAD2.0, systems must not only answer questions when possible, but also determine when no answer is supported by the paragraph and abstain from answering.

DatasetSplit# samples
SQuAD2.0train130k
SQuAD2.0eval12.3k

Training procedure

The model was trained on a Tesla T4 GPU and 12GB of RAM.

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2e-05
  • trainbatchsize: 16
  • evalbatchsize: 16
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lrschedulertype: linear
  • num_epochs: 3

Training results

Training LossEpochStepValidation Loss
1.40981.082021.3860
1.17162.0164041.8555
1.29093.0246061.8025
Metric# Value
EM52.17
F169.22

Pipeline

py
from transformers import pipeline

qa_pipeline = pipeline(
    "question-answering",
    model="esakrissa/IndoBERT-SQuAD",
    tokenizer="esakrissa/IndoBERT-SQuAD"
)

qa_pipeline({
    'context': """Sudah sejak tahun 1920-an, Ubud terkenal di antara wisatawan barat. Kala itu pelukis Jerman; Walter Spies dan pelukis Belanda; Rudolf Bonnet menetap di sana. Mereka dibantu oleh Tjokorda Gde Agung Sukawati, dari Puri Agung Ubud. Sekarang karya mereka bisa dilihat di Museum Puri Lukisan, Ubud.""",
    'question': "Sejak kapan Ubud terkenal di antara wisatawan barat?"
})

output:

py
{
'answer': '1920-an'
'start': 18, 
'end': 25,
'score': 0.8675463795661926, 
}

Github

Github

Demo

IndoBERT SQuAD Demo

Reference

<a id="1">[1]</a>Fajri Koto and Afshin Rahimi and Jey Han Lau and Timothy Baldwin. 2020. IndoLEM and IndoBERT: A Benchmark Dataset and Pre-trained Language Model for Indonesian NLP. Proceedings of the 28th COLING. <a id="2">[2]</a>rifkybujana/IndoBERT-QA

Framework versions

  • Transformers 4.25.1
  • Pytorch 1.13.0+cu116
  • Datasets 2.7.1
  • Tokenizers 0.13.2