Shaltiel commited on
Commit
0c588cb
1 Parent(s): 95780d0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +84 -0
README.md CHANGED
@@ -1,3 +1,87 @@
1
  ---
2
  license: cc-by-4.0
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-4.0
3
+ language:
4
+ - he
5
+ inference: false
6
  ---
7
+ # **DictaLM**: A Large Generative Language Model for Modern Hebrew
8
+
9
+ A large generative pretrained transformer (GPT) language model for Hebrew, released [link to be added].
10
+
11
+ - This is an alpha version of the model, and there are many improvements to come.
12
+
13
+ - We are actively working on improving the model, so stay tuned.
14
+
15
+ This is the base-model pretrained on general text completion. On it's own, it isn't very useful, but it can be fine-tuned for specific tasks (instruct, chat, QA, and more).
16
+
17
+ You can access the instruct-tuned model [here](https://huggingface.co/dicta-il/dictalm-7b-instruct).
18
+
19
+ ## Sample usage (for text completion):
20
+
21
+ ```python
22
+ from transformers import AutoModelForCausalLM, AutoTokenizer
23
+ import torch
24
+
25
+ tokenizer = AutoTokenizer.from_pretrained('dicta-il/dictalm-7b')
26
+ model = AutoModelForCausalLM.from_pretrained('dicta-il/dictalm-7b', trust_remote_code=True).cuda()
27
+
28
+ model.eval()
29
+
30
+ with torch.inference_mode():
31
+ # this prompt was taken from the headline of a [YNet](https://www.ynet.co.il/architecture/article/b1j3bzcrn) article.
32
+ prompt = '诪谞讜专讛 诪讻讜讘注 讬诐 讜讻讜住讜转 诪讘拽讘讜拽讬 驻诇住讟讬拽: 讛爪爪讛'
33
+ kwargs = dict(
34
+ inputs=tokenizer(prompt, return_tensors='pt').input_ids.to(model.device),
35
+ do_sample=True,
36
+ top_k=50,
37
+ top_p=0.95,
38
+ temperature=0.75,
39
+ max_length=100,
40
+ min_new_tokens=5
41
+ )
42
+
43
+ print(tokenizer.batch_decode(model.generate(**kwargs), skip_special_tokens=True))
44
+ ```
45
+
46
+ There are many different parameters you can input into `kwargs` for different results (greedy, beamsearch, different samplign configurations, longer/shorter respones, etc.).
47
+
48
+ You can view the full list of parameters you can pass to the `generate` function [here](https://huggingface.co/docs/transformers/v4.33.0/en/main_classes/text_generation#transformers.GenerationMixin.generate).
49
+
50
+ ### Alternative ways to initialize the model:
51
+
52
+ If you have multiple smaller GPUs, and the package `accelerate` is installed, you can initialize the model split across the devices:
53
+ ```python
54
+ model = AutoModelForCausalLM.from_pretrained('dicta-il/dictalm-7b', trust_remote_code=True, device_map='auto')
55
+ ```
56
+
57
+ If you are running on linux and have the `bitsandbytes` package installed, you can initialize the model in 4/8 bit inference mode:
58
+ ```python
59
+ model = AutoModelForCausalLM.from_pretrained('dicta-il/dictalm-7b', trust_remote_code=True, load_in_8bit=True)
60
+ ```
61
+
62
+ If you have [FlashAttention](https://github.com/Dao-AILab/flash-attention) installed in your environment, you can instruct the model to use the flash attention implementation (either V1 or V2, whichever is installed):
63
+ ```python
64
+ model = AutoModelForCausalLM.from_pretrained('dicta-il/dictalm-7b', trust_remote_code=True, use_flash_attention=True)
65
+ ```
66
+
67
+
68
+ ## Citation
69
+
70
+ If you use DictaLM in your research, please cite ```ADD CITATION HERE```
71
+
72
+ **BibTeX:**
73
+
74
+ ```ADD BIBTEXT HERE```
75
+
76
+ ## License
77
+
78
+ Shield: [![CC BY 4.0][cc-by-shield]][cc-by]
79
+
80
+ This work is licensed under a
81
+ [Creative Commons Attribution 4.0 International License][cc-by].
82
+
83
+ [![CC BY 4.0][cc-by-image]][cc-by]
84
+
85
+ [cc-by]: http://creativecommons.org/licenses/by/4.0/
86
+ [cc-by-image]: https://i.creativecommons.org/l/by/4.0/88x31.png
87
+ [cc-by-shield]: https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg