Creamte README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
widget:
|
| 6 |
+
- text: 'الخيل والليل والبيداء تعرفني [SEP] والسيف والرمح والقرطاس والقلم'
|
| 7 |
+
---
|
| 8 |
+
# CAMeLBERT-Mix Poetry Classification Model
|
| 9 |
+
## Model description
|
| 10 |
+
**CAMeLBERT-Mix Poetry Classification Model** is a poetry classification model that was built by fine-tuning the [CAMeLBERT Mix](https://huggingface.co/CAMeL-Lab/bert-base-arabic-camelbert-mix/) model.
|
| 11 |
+
For the fine-tuning, we used the [APCD](https://arxiv.org/pdf/1905.05700.pdf) dataset.
|
| 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 |
+
## Intended uses
|
| 14 |
+
You can use the CAMeLBERT-Mix Poetry Classification model as part of the transformers pipeline.
|
| 15 |
+
This model will also be available in [CAMeL Tools](https://github.com/CAMeL-Lab/camel_tools) soon.
|
| 16 |
+
#### How to use
|
| 17 |
+
To use the model with a transformers pipeline:
|
| 18 |
+
```python
|
| 19 |
+
>>> from transformers import pipeline
|
| 20 |
+
>>> poetry = pipeline('text-classification', model='CAMeL-Lab/bert-base-arabic-camelbert-mix-poetry')
|
| 21 |
+
>>> # A list of verses where each verse consists of two parts.
|
| 22 |
+
>>> verses = [
|
| 23 |
+
['الخيل والليل والبيداء تعرفني' ,'والسيف والرمح والقرطاس والقلم'],
|
| 24 |
+
['قم للمعلم وفه التبجيلا' ,'كاد المعلم ان يكون رسولا']
|
| 25 |
+
]
|
| 26 |
+
>>> # A function that concatenates the halves of each verse by using the [SEP] token.
|
| 27 |
+
>>> join_verse = lambda half: ' [SEP] '.join(half)
|
| 28 |
+
>>> # Apply this to all the verses in the list.
|
| 29 |
+
>>> verses = [join_verse(verse) for verse in verses]
|
| 30 |
+
>>> poetry(sentences)
|
| 31 |
+
[{'label': 'البسيط', 'score': 0.9937475919723511},
|
| 32 |
+
{'label': 'الكامل', 'score': 0.971284031867981}]
|
| 33 |
+
```
|
| 34 |
+
*Note*: to download our models, you would need `transformers>=3.5.0`. Otherwise, you could download the models
|
| 35 |
+
## Citation
|
| 36 |
+
```bibtex
|
| 37 |
+
@inproceedings{inoue-etal-2021-interplay,
|
| 38 |
+
title = "The Interplay of Variant, Size, and Task Type in {A}rabic Pre-trained Language Models",
|
| 39 |
+
author = "Inoue, Go and
|
| 40 |
+
Alhafni, Bashar and
|
| 41 |
+
Baimukan, Nurpeiis and
|
| 42 |
+
Bouamor, Houda and
|
| 43 |
+
Habash, Nizar",
|
| 44 |
+
booktitle = "Proceedings of the Sixth Arabic Natural Language Processing Workshop",
|
| 45 |
+
month = apr,
|
| 46 |
+
year = "2021",
|
| 47 |
+
address = "Kyiv, Ukraine (Online)",
|
| 48 |
+
publisher = "Association for Computational Linguistics",
|
| 49 |
+
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.",
|
| 50 |
+
}
|
| 51 |
+
```
|