RichardErkhov
commited on
Commit
โข
01cd1c8
1
Parent(s):
18f92e3
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
Hebrew-Mistral-7B - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/yam-peleg/
|
12 |
+
- Original model: https://huggingface.co/yam-peleg/Hebrew-Mistral-7B/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: apache-2.0
|
20 |
+
language:
|
21 |
+
- en
|
22 |
+
- he
|
23 |
+
library_name: transformers
|
24 |
+
---
|
25 |
+
# Hebrew-Mistral-7B
|
26 |
+
|
27 |
+
Hebrew-Mistral-7B is an open-source Large Language Model (LLM) pretrained in hebrew and english pretrained with 7B billion parameters, based on Mistral-7B-v1.0 from Mistral.
|
28 |
+
|
29 |
+
It has an extended hebrew tokenizer with 64,000 tokens and is continuesly pretrained from Mistral-7B on tokens in both English and Hebrew.
|
30 |
+
|
31 |
+
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.
|
32 |
+
|
33 |
+
### Usage
|
34 |
+
|
35 |
+
Below are some code snippets on how to get quickly started with running the model.
|
36 |
+
|
37 |
+
First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
|
38 |
+
|
39 |
+
### Running on CPU
|
40 |
+
|
41 |
+
```python
|
42 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
43 |
+
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
|
45 |
+
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
|
46 |
+
|
47 |
+
input_text = "ืฉืืื! ืื ืฉืืืื ืืืื?"
|
48 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
49 |
+
|
50 |
+
outputs = model.generate(**input_ids)
|
51 |
+
print(tokenizer.decode(outputs[0]))
|
52 |
+
```
|
53 |
+
|
54 |
+
### Running on GPU
|
55 |
+
|
56 |
+
```python
|
57 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
58 |
+
|
59 |
+
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
|
60 |
+
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B", device_map="auto")
|
61 |
+
|
62 |
+
input_text = "ืฉืืื! ืื ืฉืืืื ืืืื?"
|
63 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
64 |
+
|
65 |
+
outputs = model.generate(**input_ids)
|
66 |
+
print(tokenizer.decode(outputs[0]))
|
67 |
+
```
|
68 |
+
|
69 |
+
### Running with 4-Bit precision
|
70 |
+
|
71 |
+
```python
|
72 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
73 |
+
|
74 |
+
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
|
75 |
+
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B", quantization_config = BitsAndBytesConfig(load_in_4bit=True))
|
76 |
+
|
77 |
+
input_text = "ืฉืืื! ืื ืฉืืืื ืืืื?"
|
78 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
79 |
+
|
80 |
+
outputs = model.generate(**input_ids)
|
81 |
+
print(tokenizer.decode(outputs[0])
|
82 |
+
```
|
83 |
+
|
84 |
+
### Notice
|
85 |
+
|
86 |
+
Hebrew-Mistral-7B is a pretrained base model and therefore does not have any moderation mechanisms.
|
87 |
+
|
88 |
+
### Authors
|
89 |
+
- Trained by Yam Peleg.
|
90 |
+
- In collaboration with Jonathan Rouach and Arjeo, inc.
|
91 |
+
|
92 |
+
|
93 |
+
|