Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,48 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- ar
|
4 |
+
tags:
|
5 |
+
- AraBERT
|
6 |
+
- BERT2BERT
|
7 |
+
- MSA
|
8 |
+
- Arabic Text Summarization
|
9 |
+
- Arabic News Title Generation
|
10 |
+
- Arabic Paraphrasing
|
11 |
+
---
|
12 |
+
|
13 |
+
# An Arabic abstractive text summarization model
|
14 |
+
A BERT2BERT-based model whose parameters are initialized with AraBERT weights and which has been fine-tuned on a dataset of 84,764 paragraph-summary pairs.
|
15 |
+
|
16 |
+
More details on the fine-tuning of this model will be released later.
|
17 |
+
|
18 |
+
The model can be used as follows:
|
19 |
+
```python
|
20 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
21 |
+
from arabert.preprocess import ArabertPreprocessor
|
22 |
+
|
23 |
+
model_name="malmarjeh/bert2bert"
|
24 |
+
preprocessor = ArabertPreprocessor(model_name="")
|
25 |
+
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
27 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
28 |
+
pipeline = pipeline("text2text-generation",model=model,tokenizer=tokenizer)
|
29 |
+
|
30 |
+
text = "شهدت مدينة طرابلس، مساء أمس الأربعاء، احتجاجات شعبية وأعمال شغب لليوم الثالث على التوالي، وذلك بسبب تردي الوضع المعيشي والاقتصادي. واندلعت مواجهات عنيفة وعمليات كر وفر ما بين الجيش اللبناني والمحتجين استمرت لساعات، إثر محاولة فتح الطرقات المقطوعة، ما أدى إلى إصابة العشرات من الطرفين."
|
31 |
+
text = preprocessor.preprocess(text)
|
32 |
+
|
33 |
+
result = pipeline(text,
|
34 |
+
pad_token_id=tokenizer.eos_token_id,
|
35 |
+
num_beams=3,
|
36 |
+
repetition_penalty=3.0,
|
37 |
+
max_length=200,
|
38 |
+
length_penalty=1.0,
|
39 |
+
no_repeat_ngram_size = 3)[0]['generated_text']
|
40 |
+
result
|
41 |
+
>>> 'مواجهات في طرابلس لليوم الثالث على التوالي'
|
42 |
+
```
|
43 |
+
|
44 |
+
## Contact:
|
45 |
+
**Mohammad Bani Almarjeh**: [Linkedin](https://www.linkedin.com/in/mohammad-bani-almarjeh/) | <[email protected]>
|
46 |
+
|
47 |
+
|
48 |
+
|