Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,73 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
- he
|
6 |
+
library_name: transformers
|
7 |
+
---
|
8 |
+
# Hebrew-Mistral-7B-200K
|
9 |
+
|
10 |
+
Hebrew-Mistral-7B-200K is an open-source Large Language Model (LLM) pretrained in hebrew and english pretrained with 7B billion parameters and with 200K context length, based on Mistral-7B-v1.0 from Mistral.
|
11 |
+
|
12 |
+
It has an extended hebrew tokenizer with 64,000 tokens and is continuesly pretrained from Mistral-7B on tokens in both English and Hebrew.
|
13 |
+
|
14 |
+
The resulting model 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.
|
15 |
+
|
16 |
+
### Usage
|
17 |
+
|
18 |
+
Below are some code snippets on how to get quickly started with running the model.
|
19 |
+
|
20 |
+
First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
|
21 |
+
|
22 |
+
### Running on CPU
|
23 |
+
|
24 |
+
```python
|
25 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
26 |
+
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B-200K")
|
28 |
+
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B-200K")
|
29 |
+
|
30 |
+
input_text = "ืฉืืื! ืื ืฉืืืื ืืืื?"
|
31 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
32 |
+
|
33 |
+
outputs = model.generate(**input_ids)
|
34 |
+
print(tokenizer.decode(outputs[0]))
|
35 |
+
```
|
36 |
+
|
37 |
+
### Running on GPU
|
38 |
+
|
39 |
+
```python
|
40 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
41 |
+
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B-200K")
|
43 |
+
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B-200K", device_map="auto")
|
44 |
+
|
45 |
+
input_text = "ืฉืืื! ืื ืฉืืืื ืืืื?"
|
46 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
47 |
+
|
48 |
+
outputs = model.generate(**input_ids)
|
49 |
+
print(tokenizer.decode(outputs[0]))
|
50 |
+
```
|
51 |
+
|
52 |
+
### Running with 4-Bit precision
|
53 |
+
|
54 |
+
```python
|
55 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
56 |
+
|
57 |
+
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B-200K")
|
58 |
+
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B-200K", quantization_config = BitsAndBytesConfig(load_in_4bit=True))
|
59 |
+
|
60 |
+
input_text = "ืฉืืื! ืื ืฉืืืื ืืืื?"
|
61 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
62 |
+
|
63 |
+
outputs = model.generate(**input_ids)
|
64 |
+
print(tokenizer.decode(outputs[0])
|
65 |
+
```
|
66 |
+
|
67 |
+
### Notice
|
68 |
+
|
69 |
+
Hebrew-Mistral-7B-200K is a pretrained base model and therefore does not have any moderation mechanisms.
|
70 |
+
|
71 |
+
### Authors
|
72 |
+
- Trained by Yam Peleg.
|
73 |
+
|