Update README.md
Browse files
README.md
CHANGED
@@ -10,36 +10,7 @@ widget:
|
|
10 |
|
11 |
Get the Question from given Context and a Answer
|
12 |
|
13 |
-
## Model in Action 🚀
|
14 |
-
```python
|
15 |
-
from transformers import AutoTokenizer,AutoModelForSeq2SeqLM
|
16 |
|
17 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("Mihakram/Arabic_Question_Generation")
|
18 |
-
tokenizer = AutoTokenizer.from_pretrained("Mihakram/Arabic_Question_Generation")
|
19 |
-
|
20 |
-
def get_question(context,answer):
|
21 |
-
text="context: " +context + " " + "answer: " + answer + " </s>"
|
22 |
-
text_encoding = tokenizer.encode_plus(
|
23 |
-
text,return_tensors="pt"
|
24 |
-
)
|
25 |
-
model.eval()
|
26 |
-
generated_ids = model.generate(
|
27 |
-
input_ids=text_encoding['input_ids'],
|
28 |
-
attention_mask=text_encoding['attention_mask'],
|
29 |
-
max_length=64,
|
30 |
-
num_beams=5,
|
31 |
-
num_return_sequences=1
|
32 |
-
)
|
33 |
-
return tokenizer.decode(generated_ids[0],skip_special_tokens=True,clean_up_tokenization_spaces=True).replace('question: ',' ')
|
34 |
-
|
35 |
-
context="الثورة الجزائرية أو ثورة المليون شهيد، اندلعت في 1 نوفمبر 1954 ضد المستعمر الفرنسي ودامت 7 سنوات ونصف. استشهد فيها أكثر من مليون ونصف مليون جزائري"
|
36 |
-
answer =" 7 سنوات ونصف"
|
37 |
-
|
38 |
-
get_question(context,answer)
|
39 |
-
|
40 |
-
#output : question="كم استمرت الثورة الجزائرية؟ "
|
41 |
-
|
42 |
-
```
|
43 |
## Details of Ara-T5
|
44 |
|
45 |
The **Ara-T5** model was presented in [AraT5: Text-to-Text Transformers for Arabic Language Generation](https://arxiv.org/abs/2109.12068) by *El Moatez Billah Nagoudi, AbdelRahim Elmadany, Muhammad Abdul-Mageed*
|
|
|
10 |
|
11 |
Get the Question from given Context and a Answer
|
12 |
|
|
|
|
|
|
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
## Details of Ara-T5
|
15 |
|
16 |
The **Ara-T5** model was presented in [AraT5: Text-to-Text Transformers for Arabic Language Generation](https://arxiv.org/abs/2109.12068) by *El Moatez Billah Nagoudi, AbdelRahim Elmadany, Muhammad Abdul-Mageed*
|