qarib/bert-base-qarib

Model

QARiB: QCRI Arabic and Dialectal BERT

9

16 commits

2 linked in READMEs

updated May 20, 2021

See the code

README

QARiB: QCRI Arabic and Dialectal BERT

About QARiB

QCRI Arabic and Dialectal BERT (QARiB) model, was trained on a collection of ~ 420 Million tweets and ~ 180 Million sentences of text. For the tweets, the data was collected using twitter API and using language filter. lang:ar. For the text data, it was a combination from Arabic GigaWord, Abulkhair Arabic Corpus and OPUS.

QARiB: Is the Arabic name for "Boat".

Model and Parameters:

  • Data size: 14B tokens
  • Vocabulary: 64k
  • Iterations: 10M
  • Number of Layers: 12

Training QARiB

See details in Training QARiB

Using QARiB

You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to be fine-tuned on a downstream task. See the model hub to look for fine-tuned versions on a task that interests you. For more details, see Using QARiB

How to use

You can use this model directly with a pipeline for masked language modeling:

>>>from transformers import pipeline
>>>fill_mask = pipeline("fill-mask", model="./models/data60gb_86k")

>>> fill_mask("ุดูˆ ุนู†ุฏูƒู… ูŠุง [MASK]")
[{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุนุฑุจ [SEP]', 'score': 0.0990147516131401, 'token': 2355, 'token_str': 'ุนุฑุจ'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุฌู…ุงุนุฉ [SEP]', 'score': 0.051633741706609726, 'token': 2308, 'token_str': 'ุฌู…ุงุนุฉ'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุดุจุงุจ [SEP]', 'score': 0.046871256083250046, 'token': 939, 'token_str': 'ุดุจุงุจ'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุฑูุงู‚ [SEP]', 'score': 0.03598872944712639, 'token': 7664, 'token_str': 'ุฑูุงู‚'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ู†ุงุณ [SEP]', 'score': 0.031996358186006546, 'token': 271, 'token_str': 'ู†ุงุณ'}
]
>>> fill_mask("ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ [MASK]")
[
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุงู„ุนู…ู„ [SEP]', 'score': 0.0678194984793663, 'token': 4230, 'token_str': 'ุจุงู„ุนู…ู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุฐู„ูƒ [SEP]', 'score': 0.05191086605191231, 'token': 984, 'token_str': 'ุจุฐู„ูƒ'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุงู„ุงุชุตุงู„ [SEP]', 'score': 0.045264165848493576, 'token': 26096, 'token_str': 'ุจุงู„ุงุชุตุงู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุนู…ู„ู‡ [SEP]', 'score': 0.03732728958129883, 'token': 40486, 'token_str': 'ุจุนู…ู„ู‡'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุงู„ุงู…ุฑ [SEP]', 'score': 0.0246378555893898, 'token': 29124, 'token_str': 'ุจุงู„ุงู…ุฑ'}
]
>>> fill_mask("ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ [MASK]")

[{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุฐู„ูƒ [SEP]', 'score': 0.23992691934108734, 'token': 984, 'token_str': 'ุจุฐู„ูƒ'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุงู„ุงู…ุฑ [SEP]', 'score': 0.108805812895298, 'token': 29124, 'token_str': 'ุจุงู„ุงู…ุฑ'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุงู„ุนู…ู„ [SEP]', 'score': 0.06639821827411652, 'token': 4230, 'token_str': 'ุจุงู„ุนู…ู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุงู„ุงุชุตุงู„ [SEP]', 'score': 0.05613093823194504, 'token': 26096, 'token_str': 'ุจุงู„ุงุชุตุงู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุงู„ู…ุฏูŠุฑุฉ [SEP]', 'score': 0.021778125315904617, 'token': 41635, 'token_str': 'ุงู„ู…ุฏูŠุฑุฉ'}]

>>> fill_mask("ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… [MASK]")
[{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… ูˆุงู„ุฏูŠูƒ [SEP]', 'score': 0.4152909517288208, 'token': 9650, 'token_str': 'ูˆุงู„ุฏูŠูƒ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู…ู„ูŠ [SEP]', 'score': 0.07663793861865997, 'token': 294, 'token_str': '##ู„ูŠ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… ุญุงู„ูƒ [SEP]', 'score': 0.0453166700899601, 'token': 2663, 'token_str': 'ุญุงู„ูƒ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… ุงู…ูƒ [SEP]', 'score': 0.04390475153923035, 'token': 1942, 'token_str': 'ุงู…ูƒ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู…ูˆู†ูƒ [SEP]', 'score': 0.027349254116415977, 'token': 3283, 'token_str': '##ูˆู†ูƒ'}]


Evaluations:

ExperimentmBERTAraBERT0.1AraBERT1.0ArabicBERTQARiB
Dialect Identification6.06%59.92%59.85%61.70%65.21%
Emotion Detection27.90%43.89%42.37%41.65%44.35%
Named-Entity Recognition (NER)49.38%64.97%66.63%64.04%61.62%
Offensive Language Detection83.14%88.07%88.97%88.19%91.94%
Sentiment Analysis86.61%90.80%93.58%83.27%93.31%

Model Weights and Vocab Download

From Huggingface site: https://huggingface.co/qarib/bert-base-qarib

Contacts

Ahmed Abdelali, Sabit Hassan, Hamdy Mubarak, Kareem Darwish and Younes Samih

Reference

@article{abdelali2021pretraining,
    title={Pre-Training BERT on Arabic Tweets: Practical Considerations},
    author={Ahmed Abdelali and Sabit Hassan and Hamdy Mubarak and Kareem Darwish and Younes Samih},
    year={2021},
    eprint={2102.10684},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
bert
endpoints_compatible
fill-mask
pytorch
qarib
QARiB
tf
transformers

qarib/bert-base-qarib

Model

QARiB: QCRI Arabic and Dialectal BERT

9

16 commits

2 linked in READMEs

updated May 20, 2021

See the code

README

QARiB: QCRI Arabic and Dialectal BERT

About QARiB

QCRI Arabic and Dialectal BERT (QARiB) model, was trained on a collection of ~ 420 Million tweets and ~ 180 Million sentences of text. For the tweets, the data was collected using twitter API and using language filter. lang:ar. For the text data, it was a combination from Arabic GigaWord, Abulkhair Arabic Corpus and OPUS.

QARiB: Is the Arabic name for "Boat".

Model and Parameters:

  • Data size: 14B tokens
  • Vocabulary: 64k
  • Iterations: 10M
  • Number of Layers: 12

Training QARiB

See details in Training QARiB

Using QARiB

You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to be fine-tuned on a downstream task. See the model hub to look for fine-tuned versions on a task that interests you. For more details, see Using QARiB

How to use

You can use this model directly with a pipeline for masked language modeling:

>>>from transformers import pipeline
>>>fill_mask = pipeline("fill-mask", model="./models/data60gb_86k")

>>> fill_mask("ุดูˆ ุนู†ุฏูƒู… ูŠุง [MASK]")
[{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุนุฑุจ [SEP]', 'score': 0.0990147516131401, 'token': 2355, 'token_str': 'ุนุฑุจ'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุฌู…ุงุนุฉ [SEP]', 'score': 0.051633741706609726, 'token': 2308, 'token_str': 'ุฌู…ุงุนุฉ'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุดุจุงุจ [SEP]', 'score': 0.046871256083250046, 'token': 939, 'token_str': 'ุดุจุงุจ'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ุฑูุงู‚ [SEP]', 'score': 0.03598872944712639, 'token': 7664, 'token_str': 'ุฑูุงู‚'}, 
{'sequence': '[CLS] ุดูˆ ุนู†ุฏูƒู… ูŠุง ู†ุงุณ [SEP]', 'score': 0.031996358186006546, 'token': 271, 'token_str': 'ู†ุงุณ'}
]
>>> fill_mask("ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ [MASK]")
[
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุงู„ุนู…ู„ [SEP]', 'score': 0.0678194984793663, 'token': 4230, 'token_str': 'ุจุงู„ุนู…ู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุฐู„ูƒ [SEP]', 'score': 0.05191086605191231, 'token': 984, 'token_str': 'ุจุฐู„ูƒ'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุงู„ุงุชุตุงู„ [SEP]', 'score': 0.045264165848493576, 'token': 26096, 'token_str': 'ุจุงู„ุงุชุตุงู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุนู…ู„ู‡ [SEP]', 'score': 0.03732728958129883, 'token': 40486, 'token_str': 'ุจุนู…ู„ู‡'}, 
{'sequence': '[CLS] ูˆู‚ุงู… ุงู„ู…ุฏูŠุฑ ุจุงู„ุงู…ุฑ [SEP]', 'score': 0.0246378555893898, 'token': 29124, 'token_str': 'ุจุงู„ุงู…ุฑ'}
]
>>> fill_mask("ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ [MASK]")

[{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุฐู„ูƒ [SEP]', 'score': 0.23992691934108734, 'token': 984, 'token_str': 'ุจุฐู„ูƒ'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุงู„ุงู…ุฑ [SEP]', 'score': 0.108805812895298, 'token': 29124, 'token_str': 'ุจุงู„ุงู…ุฑ'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุงู„ุนู…ู„ [SEP]', 'score': 0.06639821827411652, 'token': 4230, 'token_str': 'ุจุงู„ุนู…ู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุจุงู„ุงุชุตุงู„ [SEP]', 'score': 0.05613093823194504, 'token': 26096, 'token_str': 'ุจุงู„ุงุชุตุงู„'}, 
{'sequence': '[CLS] ูˆู‚ุงู…ุช ุงู„ู…ุฏูŠุฑุฉ ุงู„ู…ุฏูŠุฑุฉ [SEP]', 'score': 0.021778125315904617, 'token': 41635, 'token_str': 'ุงู„ู…ุฏูŠุฑุฉ'}]

>>> fill_mask("ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… [MASK]")
[{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… ูˆุงู„ุฏูŠูƒ [SEP]', 'score': 0.4152909517288208, 'token': 9650, 'token_str': 'ูˆุงู„ุฏูŠูƒ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู…ู„ูŠ [SEP]', 'score': 0.07663793861865997, 'token': 294, 'token_str': '##ู„ูŠ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… ุญุงู„ูƒ [SEP]', 'score': 0.0453166700899601, 'token': 2663, 'token_str': 'ุญุงู„ูƒ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู… ุงู…ูƒ [SEP]', 'score': 0.04390475153923035, 'token': 1942, 'token_str': 'ุงู…ูƒ'}, 
{'sequence': '[CLS] ู‚ู„ู„ูŠ ูˆุดููŠูŠูŠูƒ ูŠุฑุญู…ูˆู†ูƒ [SEP]', 'score': 0.027349254116415977, 'token': 3283, 'token_str': '##ูˆู†ูƒ'}]


Evaluations:

ExperimentmBERTAraBERT0.1AraBERT1.0ArabicBERTQARiB
Dialect Identification6.06%59.92%59.85%61.70%65.21%
Emotion Detection27.90%43.89%42.37%41.65%44.35%
Named-Entity Recognition (NER)49.38%64.97%66.63%64.04%61.62%
Offensive Language Detection83.14%88.07%88.97%88.19%91.94%
Sentiment Analysis86.61%90.80%93.58%83.27%93.31%

Model Weights and Vocab Download

From Huggingface site: https://huggingface.co/qarib/bert-base-qarib

Contacts

Ahmed Abdelali, Sabit Hassan, Hamdy Mubarak, Kareem Darwish and Younes Samih

Reference

@article{abdelali2021pretraining,
    title={Pre-Training BERT on Arabic Tweets: Practical Considerations},
    author={Ahmed Abdelali and Sabit Hassan and Hamdy Mubarak and Kareem Darwish and Younes Samih},
    year={2021},
    eprint={2102.10684},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
bert
endpoints_compatible
fill-mask
pytorch
qarib
QARiB
tf
transformers