Transformers
PyTorch
Arabic
encoder-decoder
text2text-generation
Transformer
MSA
Arabic Text Summarization
Arabic News Title Generation
Arabic Paraphrasing
Instructions to use malmarjeh/transformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use malmarjeh/transformer with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("malmarjeh/transformer") model = AutoModelForSeq2SeqLM.from_pretrained("malmarjeh/transformer") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- ar
|
| 4 |
+
tags:
|
| 5 |
+
- Transformer
|
| 6 |
+
- MSA
|
| 7 |
+
- Arabic Text Summarization
|
| 8 |
+
- Arabic News Title Generation
|
| 9 |
+
- Arabic Paraphrasing
|
| 10 |
+
widget:
|
| 11 |
+
- text: "شهدت مدينة طرابلس، مساء أمس الأربعاء، احتجاجات شعبية وأعمال شغب لليوم الثالث على التوالي، وذلك بسبب تردي الوضع المعيشي والاقتصادي. واندلعت مواجهات عنيفة وعمليات كر وفر ما بين الجيش اللبناني والمحتجين استمرت لساعات، إثر محاولة فتح الطرقات المقطوعة، ما أدى إلى إصابة العشرات من الطرفين."
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# An Arabic abstractive text summarization model
|
| 15 |
+
A Transformer-based encoder-decoder model which has been trained on a dataset of 384,764 paragraph-summary pairs.
|
| 16 |
+
|
| 17 |
+
More details on the training of this model will be released later.
|
| 18 |
+
|
| 19 |
+
The model can be used as follows:
|
| 20 |
+
```python
|
| 21 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
| 22 |
+
from arabert.preprocess import ArabertPreprocessor
|
| 23 |
+
|
| 24 |
+
model_name="malmarjeh/transformer"
|
| 25 |
+
preprocessor = ArabertPreprocessor(model_name="")
|
| 26 |
+
|
| 27 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 28 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 29 |
+
pipeline = pipeline("text2text-generation",model=model,tokenizer=tokenizer)
|
| 30 |
+
|
| 31 |
+
text = "شهدت مدينة طرابلس، مساء أمس الأربعاء، احتجاجات شعبية وأعمال شغب لليوم الثالث على التوالي، وذلك بسبب تردي الوضع المعيشي والاقتصادي. واندلعت مواجهات عنيفة وعمليات كر وفر ما بين الجيش اللبناني والمحتجين استمرت لساعات، إثر محاولة فتح الطرقات المقطوعة، ما أدى إلى إصابة العشرات من الطرفين."
|
| 32 |
+
text = preprocessor.preprocess(text)
|
| 33 |
+
|
| 34 |
+
result = pipeline(text,
|
| 35 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 36 |
+
num_beams=3,
|
| 37 |
+
repetition_penalty=3.0,
|
| 38 |
+
max_length=200,
|
| 39 |
+
length_penalty=1.0,
|
| 40 |
+
no_repeat_ngram_size = 3)[0]['generated_text']
|
| 41 |
+
result
|
| 42 |
+
>>> 'احتجاجات شعبية في طرابلس لليوم الثالث على التوالي'
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## Contact:
|
| 46 |
+
**Mohammad Bani Almarjeh**: [Linkedin](https://www.linkedin.com/in/mohammad-bani-almarjeh/) | <banimarje@gmail.com>
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|