Update README.md
Browse files
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
|
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 |
-
|
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 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
outputs = model.generate(**input_ids)
|
46 |
-
print(tokenizer.decode(outputs[0]))
|
47 |
```
|
48 |
|
49 |
-
|
|
|
|
|
|
|
50 |
|
51 |
```python
|
52 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
53 |
|
54 |
-
|
55 |
-
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Gemma-11B-Instruct", device_map="auto")
|
56 |
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
|
|
|
|
62 |
```
|
63 |
|
64 |
-
###
|
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 |
-
|
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 |
|