Update README.md
Browse files
README.md
CHANGED
@@ -17,20 +17,19 @@ from transformers import AutoTokenizer,AutoModelForSeq2SeqLM
|
|
17 |
model = AutoModelForSeq2SeqLM.from_pretrained("Mihakram/Arabic_Question_Generation")
|
18 |
tokenizer = AutoTokenizer.from_pretrained("Mihakram/Arabic_Question_Generation")
|
19 |
|
20 |
-
def
|
21 |
text="context: " +context + " " + "answer: " + answer + " </s>"
|
22 |
text_encoding = tokenizer.encode_plus(
|
23 |
text,return_tensors="pt"
|
24 |
)
|
25 |
model.eval()
|
26 |
-
|
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 |
-
|
34 |
return tokenizer.decode(generated_ids[0],skip_special_tokens=True,clean_up_tokenization_spaces=True).replace('question: ',' ')
|
35 |
|
36 |
context="الثورة الجزائرية أو ثورة المليون شهيد، اندلعت في 1 نوفمبر 1954 ضد المستعمر الفرنسي ودامت 7 سنوات ونصف. استشهد فيها أكثر من مليون ونصف مليون جزائري"
|
@@ -61,4 +60,9 @@ If you want to cite this model you can use this:
|
|
61 |
}
|
62 |
```
|
63 |
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
17 |
model = AutoModelForSeq2SeqLM.from_pretrained("Mihakram/Arabic_Question_Generation")
|
18 |
tokenizer = AutoTokenizer.from_pretrained("Mihakram/Arabic_Question_Generation")
|
19 |
|
20 |
+
def generate__questions(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 سنوات ونصف. استشهد فيها أكثر من مليون ونصف مليون جزائري"
|
|
|
60 |
}
|
61 |
```
|
62 |
|
63 |
+
## Contacts
|
64 |
+
|
65 |
+
**Mihoubi Akram Fawzi**: [Linkedin]() | [Twitter]() | [Github](https://github.com/mihoubi-akram) |<[email protected]>
|
66 |
+
|
67 |
+
**Ibrir Adel**: [Linkedin]() | [Twitter]() | [Github]() |<>
|
68 |
+
|