yam-peleg commited on
Commit
dd6c080
โ€ข
1 Parent(s): c39aa50

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -46
README.md CHANGED
@@ -12,69 +12,45 @@ library_name: transformers
12
  - **Base Model:** [Hebrew-Gemma-11B](https://huggingface.co/yam-peleg/Hebrew-Gemma-11B)
13
  - **Instruct Model:** [Hebrew-Gemma-11B-Instruct](https://huggingface.co/yam-peleg/Hebrew-Gemma-11B-Instruct)
14
 
15
- Hebrew-Gemma-11B is an open-source Large Language Model (LLM) is a hebrew/english pretrained generative text model with 11 billion parameters, based on the Gemma-7B architecture from Google.
16
 
17
  It is continued pretrain of gemma-7b, extended to a larger scale and trained on 3B additional tokens of both English and Hebrew text data.
18
 
19
- The resulting model Gemma-11B is a powerful general-purpose language model suitable for a wide range of natural language processing tasks, with a focus on Hebrew language understanding and generation.
20
 
 
21
 
22
- ### Terms of Use
23
-
24
- As an extention of Gemma-7B, this model is subject to the original license and terms of use by Google.
25
-
26
- **Gemma-7B original Terms of Use**: [Terms](https://www.kaggle.com/models/google/gemma/license/consent)
27
-
28
- ### Usage
29
-
30
- Below are some code snippets on how to get quickly started with running the model.
31
-
32
- First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
33
-
34
- ### Running on CPU
35
-
36
- ```python
37
- from transformers import AutoTokenizer, AutoModelForCausalLM
38
 
39
- tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct")
40
- model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct")
41
-
42
- input_text = "ืฉืœื•ื! ืžื” ืฉืœื•ืžืš ื”ื™ื•ื?"
43
- input_ids = tokenizer(input_text, return_tensors="pt")
44
-
45
- outputs = model.generate(**input_ids)
46
- print(tokenizer.decode(outputs[0]))
47
  ```
48
 
49
- ### Running on GPU
 
 
 
50
 
51
  ```python
52
  from transformers import AutoTokenizer, AutoModelForCausalLM
53
 
54
- tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct")
55
- model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct", device_map="auto")
56
 
57
- input_text = "ืฉืœื•ื! ืžื” ืฉืœื•ืžืš ื”ื™ื•ื?"
58
- input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
59
 
60
- outputs = model.generate(**input_ids)
61
- print(tokenizer.decode(outputs[0]))
 
 
62
  ```
63
 
64
- ### Running with 4-Bit precision
65
-
66
- ```python
67
- from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
68
-
69
- tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct")
70
- model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct", quantization_config = BitsAndBytesConfig(load_in_4bit=True))
71
-
72
- input_text = "ืฉืœื•ื! ืžื” ืฉืœื•ืžืš ื”ื™ื•ื?"
73
- input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
74
 
75
- outputs = model.generate(**input_ids)
76
- print(tokenizer.decode(outputs[0])
77
- ```
78
 
79
  ### Benchmark Results
80
 
 
12
  - **Base Model:** [Hebrew-Gemma-11B](https://huggingface.co/yam-peleg/Hebrew-Gemma-11B)
13
  - **Instruct Model:** [Hebrew-Gemma-11B-Instruct](https://huggingface.co/yam-peleg/Hebrew-Gemma-11B-Instruct)
14
 
15
+ The Hebrew-Gemma-11B-Instruct Large Language Model (LLM) is a instruct fine-tuned version of the [Hebrew-Gemma-11B](https://huggingface.co/yam-peleg/Hebrew-Gemma-11B) generative text model using a variety of conversation datasets.
16
 
17
  It is continued pretrain of gemma-7b, extended to a larger scale and trained on 3B additional tokens of both English and Hebrew text data.
18
 
 
19
 
20
+ # Instruction format
21
 
22
+ This format must be strictly respected, otherwise the model will generate sub-optimal outputs.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ ```
25
+ <bos><start_of_turn>user
26
+ Write a hello world program<end_of_turn>
27
+ <start_of_turn>model
28
+ Here is a simple hellow world program<end_of_turn>
29
+ <eos>
 
 
30
  ```
31
 
32
+ Each turn is preceded by a <start_of_turn> delimiter and then the role of the entity (either user, for content supplied by the user, or model for LLM responses). Turns finish with the <end_of_turn> token.
33
+ You can follow this format to build the prompt manually, if you need to do it without the tokenizer's chat template.
34
+
35
+ A simple example:
36
 
37
  ```python
38
  from transformers import AutoTokenizer, AutoModelForCausalLM
39
 
40
+ model_id = "Hebrew-Gemma-11B-Instruct"
 
41
 
42
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
43
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="cuda")
44
 
45
+ chat = [
46
+ { "role": "user", "content": "ื›ืชื•ื‘ ืงื•ื“ ืคืฉื•ื˜ ื‘ืคื™ื™ืชื•ืŸ ืฉืžื“ืคื™ืก ืœืžืกืš ืืช ื”ืชืืจื™ืš ืฉืœ ื”ื™ื•ื" },
47
+ ]
48
+ prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
49
  ```
50
 
51
+ ### Terms of Use
 
 
 
 
 
 
 
 
 
52
 
53
+ As an extention of Gemma-7B, this model is subject to the original license and terms of use by Google.
 
 
54
 
55
  ### Benchmark Results
56