File size: 3,412 Bytes
7705825
 
 
 
795259c
 
 
b645603
9920e0d
 
c5ce04c
9920e0d
d0eb494
fc909a1
 
 
d0eb494
 
215304c
 
 
 
 
7917561
 
 
d0eb494
7917561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0eb494
 
 
 
 
 
 
 
 
 
 
 
 
 
a29392c
 
fa78651
a29392c
fa78651
a29392c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
language: 
- ar
widget:
- text: "context: الثورة الجزائرية أو ثورة المليون شهيد، اندلعت في 1 نوفمبر 1954 ضد المستعمر الفرنسي ودامت 7 سنوات ونصف. استشهد فيها أكثر من مليون ونصف مليون جزائري answer:  7 سنوات ونصف </s>
"
- text: "context: اسكتلندا دولة في شمال غرب أوروبا، تعتبر جزء من الدول الأربع المكونة المملكة المتحدة. تحتل الثلث الشمالي من جزيرة بريطانيا العظمى وتحدها جنوبا إنجلترا ويحدها شرقا بحر الشمال وغربا المحيط الأطلسي. عاصمتها أدنبرة، وأهم مدنها وأكبرها مدينة غلاسكو. كانت اسكتلندا مملكة مستقلة حتى 1 مايو 1707  answer:  أدنبرة  </s>"

- text: "context: مات المستشار الألماني أدولف هتلر في 30 أبريل 1945 منتحرا عن طريق تناول مادة السيانيد السامة وإطلاق النار على نفسه وهي الرواية العامة المقبولة لطريقة موت الزعيم النازي answer: منتحرا </s>
"

---
# Arabic Question generation Model
[AraT5-Base Model](https://huggingface.co/UBC-NLP/AraT5-base) fine-tuned on Arabic Question-Answering Dataset for **Question generation**

Get the Question from given Context and a Answer
 

## Details of Ara-T5

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* 


## Model in Action 🚀
```python
from transformers import AutoTokenizer,AutoModelForSeq2SeqLM

model = AutoModelForSeq2SeqLM.from_pretrained("Mihakram/Arabic_Question_Generation")
tokenizer = AutoTokenizer.from_pretrained("Mihakram/Arabic_Question_Generation")

def get_question(context,answer):
  text="context: " +context + " " + "answer: " + answer + " </s>"
  text_encoding = tokenizer.encode_plus(
      text,return_tensors="pt"
  )
  model.eval()
  generated_ids =  model.generate(
    input_ids=text_encoding['input_ids'],
    attention_mask=text_encoding['attention_mask'],
    max_length=64,
    num_beams=5,
    num_return_sequences=1
  )
  return tokenizer.decode(generated_ids[0],skip_special_tokens=True,clean_up_tokenization_spaces=True).replace('question: ',' ')

context="الثورة الجزائرية أو ثورة المليون شهيد، اندلعت في 1 نوفمبر 1954 ضد المستعمر الفرنسي ودامت 7 سنوات ونصف. استشهد فيها أكثر من مليون ونصف مليون جزائري"
answer =" 7 سنوات ونصف"

get_question(context,answer)

#output : question="كم استمرت الثورة الجزائرية؟ " 

```
## Citation
If you want to cite this model you can use this:

```bibtex
@misc{Mihakram/,
  title={},
  author={Mihoubi, Ibrir},
  publisher={Hugging Face},
  journal={Hugging Face Hub},
  howpublished={\url{https://huggingface.co/}},
  year={2022}
}
```

## Contacts

**Mihoubi Akram Fawzi**: [Linkedin](https://www.linkedin.com/in/mihoubi-akram/) | [Github](https://github.com/mihoubi-akram) | <[email protected]>

**Ibrir Adel**: [Linkedin]() | [Github]() | <[email protected]>