Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
language:
|
4 |
+
- he
|
5 |
+
inference: false
|
6 |
+
---
|
7 |
+
# Google's mT5-XL - Finetuned for Hebrew Question-Answering
|
8 |
+
|
9 |
+
[Google's mT5](https://github.com/google-research/multilingual-t5) multilingual Seq2Seq model, finetuned on [HeQ](https://u.cs.biu.ac.il/~yogo/heq.pdf) for the Hebrew Question-Answering task.
|
10 |
+
|
11 |
+
This is the model that was reported in the `DictaBERT` release [here](https://arxiv.org/abs/2308.16687).
|
12 |
+
|
13 |
+
Sample usage:
|
14 |
+
|
15 |
+
```python
|
16 |
+
import torch
|
17 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
18 |
+
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained('dicta-il/mT5-XL-HeQ-ft')
|
20 |
+
model = AutoModelForSeq2SeqLM.from_pretrained('dicta-il/mT5-XL-HeQ-ft')
|
21 |
+
|
22 |
+
model.eval()
|
23 |
+
|
24 |
+
question='ืืืฆื ืืืืื ืืืืืข ืฉื ืืชื ืืืฉืื ืืืืฆืขืืช ืืขืืืืืช?'
|
25 |
+
context='ืื ืืืช ืคืจืืคืืืื ืฉื ืืฉืชืืฉืื ื ืืฉืืช ืขื ืืื ืจืืื ืืืืื ืคืืื ืฆืืืื ืขื ืืคืจืืืืช. ืืกืืื ืื ืืืืืื ืืืง ืืืืืื ืืช ืืืืฆืขืืช ืืงืืงื ืืช ืืืืืข ืฉื ืืชื ืืืฉืื ืืืืฆืขืืช ืขืืืืืช ืืืช ืืืคื ืืฉืืืืฉ ืืขืืืืืช. ืืจืฆืืช ืืืจืืช, ืืืฉื, ืงืืขื ืืืงืื ื ืืงืฉืื ืืื ืื ืืืข ืืืฆืืจืช ืขืืืืืช ืืืฉืืช. ืืืงืื ืืื, ืืฉืจ ื ืงืืขื ืืฉื ืช 2000, ื ืงืืขื ืืืืจ ืฉื ืืฉืฃ ืื ืืืฉืจื ืืืืฉืื ืืืืื ืืืช ืฉื ืืืืฉื ืืืืจืืงืื ื ืื ืืฉืืืืฉ ืืกืืื (ONDCP) ืืืืช ืืืื ืืฉืชืืฉ ืืขืืืืืช ืืื ืืขืงืื ืืืจื ืืฉืชืืฉืื ืฉืฆืคื ืืคืจืกืืืืช ื ืื ืืฉืืืืฉ ืืกืืื ืืืืจื ืืืืืง ืืื ืืฉืชืืฉืื ืืื ื ืื ืกื ืืืชืจืื ืืชืืืืื ืืฉืืืืฉ ืืกืืื. ืื ืืื ืืจืื ื, ืคืขืื ืืืืื ืืคืจืืืืช ืืืฉืชืืฉืื ืืืื ืืจื ื, ืืฉืฃ ืื ื-CIA ืฉืื ืขืืืืืช ืงืืืขืืช ืืืืฉืื ืืืจืืื ืืืฉื ืขืฉืจ ืฉื ืื. ื-25 ืืืฆืืืจ 2005 ืืืื ืืจืื ื ืื ืืกืืื ืืช ืืืืืืื ืืืืื (ื-NSA) ืืฉืืืจื ืฉืชื ืขืืืืืช ืงืืืขืืช ืืืืฉืื ืืืงืจืื ืืืื ืฉืืจืื ืชืืื ื. ืืืืจ ืฉืื ืืฉื ืคืืจืกื, ืื ืืืืื ืืื ืืช ืืฉืืืืฉ ืืื.'
|
26 |
+
|
27 |
+
with torch.inference_mode():
|
28 |
+
prompt = 'question: %s context: %s ' % (question, context)
|
29 |
+
kwargs = dict(
|
30 |
+
inputs=tokenizer(prompt, return_tensors='pt').input_ids.to(model.device),
|
31 |
+
do_sample=True,
|
32 |
+
top_k=50,
|
33 |
+
top_p=0.95,
|
34 |
+
temperature=0.75,
|
35 |
+
max_length=100,
|
36 |
+
min_new_tokens=2
|
37 |
+
)
|
38 |
+
|
39 |
+
print(tokenizer.batch_decode(model.generate(**kwargs), skip_special_tokens=True))
|
40 |
+
```
|
41 |
+
|
42 |
+
Output:
|
43 |
+
```json
|
44 |
+
["ืืืืฆืขืืช ืืงืืงื"]
|
45 |
+
```
|
46 |
+
|
47 |
+
|
48 |
+
## Citation
|
49 |
+
|
50 |
+
If you use `mT5-XL-HeQ-ft` in your research, please cite ```citation to be added```
|
51 |
+
|
52 |
+
**BibTeX:**
|
53 |
+
|
54 |
+
```bibtex
|
55 |
+
citation to be added
|
56 |
+
```
|
57 |
+
|
58 |
+
## License
|
59 |
+
|
60 |
+
Shield: [![CC BY 4.0][cc-by-shield]][cc-by]
|
61 |
+
|
62 |
+
This work is licensed under a
|
63 |
+
[Creative Commons Attribution 4.0 International License][cc-by].
|
64 |
+
|
65 |
+
[![CC BY 4.0][cc-by-image]][cc-by]
|
66 |
+
|
67 |
+
[cc-by]: http://creativecommons.org/licenses/by/4.0/
|
68 |
+
[cc-by-image]: https://i.creativecommons.org/l/by/4.0/88x31.png
|
69 |
+
[cc-by-shield]: https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|