Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
An Arabic abstractive text summarization model.
|
| 2 |
+
A fine-tuned AraT5 model on a dataset that consists of 86,523 paragraph-summary pairs.
|
| 3 |
+
|
| 4 |
+
More details on the fine-tuning of this model will be released later.
|
| 5 |
+
|
| 6 |
+
The model can be used as follows:
|
| 7 |
+
```python
|
| 8 |
+
from arabert.preprocess import ArabertPreprocessor
|
| 9 |
+
|
| 10 |
+
model_name="malmarjeh/t5-arabic-text-summarization"
|
| 11 |
+
arabert_prep = ArabertPreprocessor(model_name=model_name)
|
| 12 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 13 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 14 |
+
pipeline = pipeline("text2text-generation",model=model,tokenizer=tokenizer)
|
| 15 |
+
|
| 16 |
+
text = "ولن نبالغ إذا قلنا إن هاتف أو كمبيوتر المكتب في زمننا هذا ضروري"
|
| 17 |
+
preprocessor = ArabertPreprocessor(model_name="")
|
| 18 |
+
preprocessor.preprocess(text)
|
| 19 |
+
result = pipeline(text,
|
| 20 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 21 |
+
num_beams=3,
|
| 22 |
+
repetition_penalty=3.0,
|
| 23 |
+
max_length=200,
|
| 24 |
+
length_penalty=1.0,
|
| 25 |
+
no_repeat_ngram_size = 3)[0]['generated_text']
|
| 26 |
+
result
|
| 27 |
+
>>>"و+ لن نبالغ إذا قل +نا إن هاتف أو كمبيوتر ال+ مكتب في زمن +نا هذا ضروري"
|
| 28 |
+
```
|