Go Inoue commited on
Commit ·
02cca83
1
Parent(s): 95d2262
Add model files
Browse files- CAMeLBERT_MSA_preds_test_results +2 -0
- README.md +47 -0
- config.json +67 -0
- optimizer.pt +3 -0
- pytorch_model.bin +3 -0
- scheduler.pt +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +1 -0
- training_args.bin +3 -0
- vocab.txt +0 -0
CAMeLBERT_MSA_preds_test_results
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Scores:
|
| 2 |
+
{'recall': 0.25472154678665587, 'f1': 0.24880961676176644, 'precision': 0.26985987572701287, 'accuracy': 0.41199999999999998}
|
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
widget:
|
| 6 |
+
- text: "عامل ايه ؟"
|
| 7 |
+
---
|
| 8 |
+
# CAMeLBERT-MSA DID NADI Model
|
| 9 |
+
## Model description
|
| 10 |
+
**CAMeLBERT-MSA DID NADI Model** is a dialect identification (DID) model that was built by fine-tuning the [CAMeLBERT Modern Standard Arabic (MSA)](https://huggingface.co/CAMeL-Lab/bert-base-arabic-camelbert-msa/) model.
|
| 11 |
+
For the fine-tuning, we used the [NADI Coountry-level](https://sites.google.com/view/nadi-shared-task) dataset, which includes 21 labels.
|
| 12 |
+
Our fine-tuning procedure and the hyperparameters we used can be found in our paper *"[The Interplay of Variant, Size, and Task Type in Arabic Pre-trained Language Models](https://arxiv.org/abs/2103.06678)."* Our fine-tuning code can be found [here](https://github.com/CAMeL-Lab/CAMeLBERT).
|
| 13 |
+
|
| 14 |
+
## Intended uses
|
| 15 |
+
You can use the CAMeLBERT-MSA DID NADI model as part of the transformers pipeline.
|
| 16 |
+
This model will also be available in [CAMeL Tools](https://github.com/CAMeL-Lab/camel_tools) soon.
|
| 17 |
+
|
| 18 |
+
#### How to use
|
| 19 |
+
To use the model with a transformers pipeline:
|
| 20 |
+
```python
|
| 21 |
+
>>> from transformers import pipeline
|
| 22 |
+
>>> did = pipeline('text-classification', model='CAMeL-Lab/bert-base-arabic-camelbert-msa-did-nadi')
|
| 23 |
+
>>> sentences = ['عامل ايه ؟', 'شلونك ؟ شخبارك ؟']
|
| 24 |
+
>>> did(sentences)
|
| 25 |
+
[{'label': 'Egypt', 'score': 0.9242768287658691},
|
| 26 |
+
{'label': 'Saudi_Arabia', 'score': 0.3400847613811493}]
|
| 27 |
+
```
|
| 28 |
+
*Note*: to download our models, you would need `transformers>=3.5.0`.
|
| 29 |
+
Otherwise, you could download the models manually.
|
| 30 |
+
|
| 31 |
+
## Citation
|
| 32 |
+
```bibtex
|
| 33 |
+
@inproceedings{inoue-etal-2021-interplay,
|
| 34 |
+
title = "The Interplay of Variant, Size, and Task Type in {A}rabic Pre-trained Language Models",
|
| 35 |
+
author = "Inoue, Go and
|
| 36 |
+
Alhafni, Bashar and
|
| 37 |
+
Baimukan, Nurpeiis and
|
| 38 |
+
Bouamor, Houda and
|
| 39 |
+
Habash, Nizar",
|
| 40 |
+
booktitle = "Proceedings of the Sixth Arabic Natural Language Processing Workshop",
|
| 41 |
+
month = apr,
|
| 42 |
+
year = "2021",
|
| 43 |
+
address = "Kyiv, Ukraine (Online)",
|
| 44 |
+
publisher = "Association for Computational Linguistics",
|
| 45 |
+
abstract = "In this paper, we explore the effects of language variants, data sizes, and fine-tuning task types in Arabic pre-trained language models. To do so, we build three pre-trained language models across three variants of Arabic: Modern Standard Arabic (MSA), dialectal Arabic, and classical Arabic, in addition to a fourth language model which is pre-trained on a mix of the three. We also examine the importance of pre-training data size by building additional models that are pre-trained on a scaled-down set of the MSA variant. We compare our different models to each other, as well as to eight publicly available models by fine-tuning them on five NLP tasks spanning 12 datasets. Our results suggest that the variant proximity of pre-training data to fine-tuning data is more important than the pre-training data size. We exploit this insight in defining an optimized system selection model for the studied tasks.",
|
| 46 |
+
}
|
| 47 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"BertForSequenceClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"finetuning_task": "arabic_did_nadi_country",
|
| 7 |
+
"gradient_checkpointing": false,
|
| 8 |
+
"hidden_act": "gelu",
|
| 9 |
+
"hidden_dropout_prob": 0.1,
|
| 10 |
+
"hidden_size": 768,
|
| 11 |
+
"id2label": {
|
| 12 |
+
"0": "Algeria",
|
| 13 |
+
"1": "Bahrain",
|
| 14 |
+
"10": "Morocco",
|
| 15 |
+
"11": "Oman",
|
| 16 |
+
"12": "Palestine",
|
| 17 |
+
"13": "Qatar",
|
| 18 |
+
"14": "Saudi_Arabia",
|
| 19 |
+
"15": "Somalia",
|
| 20 |
+
"16": "Sudan",
|
| 21 |
+
"17": "Syria",
|
| 22 |
+
"18": "Tunisia",
|
| 23 |
+
"19": "United_Arab_Emirates",
|
| 24 |
+
"2": "Djibouti",
|
| 25 |
+
"20": "Yemen",
|
| 26 |
+
"3": "Egypt",
|
| 27 |
+
"4": "Iraq",
|
| 28 |
+
"5": "Jordan",
|
| 29 |
+
"6": "Kuwait",
|
| 30 |
+
"7": "Lebanon",
|
| 31 |
+
"8": "Libya",
|
| 32 |
+
"9": "Mauritania"
|
| 33 |
+
},
|
| 34 |
+
"initializer_range": 0.02,
|
| 35 |
+
"intermediate_size": 3072,
|
| 36 |
+
"label2id": {
|
| 37 |
+
"Algeria": 0,
|
| 38 |
+
"Bahrain": 1,
|
| 39 |
+
"Djibouti": 2,
|
| 40 |
+
"Egypt": 3,
|
| 41 |
+
"Iraq": 4,
|
| 42 |
+
"Jordan": 5,
|
| 43 |
+
"Kuwait": 6,
|
| 44 |
+
"Lebanon": 7,
|
| 45 |
+
"Libya": 8,
|
| 46 |
+
"Mauritania": 9,
|
| 47 |
+
"Morocco": 10,
|
| 48 |
+
"Oman": 11,
|
| 49 |
+
"Palestine": 12,
|
| 50 |
+
"Qatar": 13,
|
| 51 |
+
"Saudi_Arabia": 14,
|
| 52 |
+
"Somalia": 15,
|
| 53 |
+
"Sudan": 16,
|
| 54 |
+
"Syria": 17,
|
| 55 |
+
"Tunisia": 18,
|
| 56 |
+
"United_Arab_Emirates": 19,
|
| 57 |
+
"Yemen": 20
|
| 58 |
+
},
|
| 59 |
+
"layer_norm_eps": 1e-12,
|
| 60 |
+
"max_position_embeddings": 512,
|
| 61 |
+
"model_type": "bert",
|
| 62 |
+
"num_attention_heads": 12,
|
| 63 |
+
"num_hidden_layers": 12,
|
| 64 |
+
"pad_token_id": 0,
|
| 65 |
+
"type_vocab_size": 2,
|
| 66 |
+
"vocab_size": 30000
|
| 67 |
+
}
|
optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de534fa31bb040c5c676ccd494b6f9ea30e88702dbb41e5f378c814a67a0baf1
|
| 3 |
+
size 872839970
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:73cb484b5d00b56715cb429b793b30dcc88f73c634af5a61c6aa632ac1f56e7e
|
| 3 |
+
size 436444537
|
scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2171d679bb6bd503ddb8253474c93ed9657d42e28f3009a240a105ac821fef92
|
| 3 |
+
size 326
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
tf_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12e972e7607a618efbc36cf8e48d9e27dd08257293f9ddf23c7ec58f43996972
|
| 3 |
+
size 436592640
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"do_lower_case": false, "special_tokens_map_file": null, "full_tokenizer_file": null}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b28e43a0c7a1947b0e7b05d233704d5cdcba86aed27625434780c3a4267bd130
|
| 3 |
+
size 1388
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|