Shaltiel commited on
Commit
f3e4294
ยท
1 Parent(s): a65fd7e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +73 -0
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
+