Update README.md
Browse files
README.md
CHANGED
@@ -38,7 +38,8 @@ model-index:
|
|
38 |
value: 46.08
|
39 |
name: normalized accuracy
|
40 |
source:
|
41 |
-
url:
|
|
|
42 |
name: Open LLM Leaderboard
|
43 |
- task:
|
44 |
type: text-generation
|
@@ -54,7 +55,8 @@ model-index:
|
|
54 |
value: 74.16
|
55 |
name: normalized accuracy
|
56 |
source:
|
57 |
-
url:
|
|
|
58 |
name: Open LLM Leaderboard
|
59 |
- task:
|
60 |
type: text-generation
|
@@ -71,7 +73,8 @@ model-index:
|
|
71 |
value: 46.17
|
72 |
name: accuracy
|
73 |
source:
|
74 |
-
url:
|
|
|
75 |
name: Open LLM Leaderboard
|
76 |
- task:
|
77 |
type: text-generation
|
@@ -87,7 +90,8 @@ model-index:
|
|
87 |
- type: mc2
|
88 |
value: 46.49
|
89 |
source:
|
90 |
-
url:
|
|
|
91 |
name: Open LLM Leaderboard
|
92 |
- task:
|
93 |
type: text-generation
|
@@ -104,7 +108,8 @@ model-index:
|
|
104 |
value: 65.51
|
105 |
name: accuracy
|
106 |
source:
|
107 |
-
url:
|
|
|
108 |
name: Open LLM Leaderboard
|
109 |
- task:
|
110 |
type: text-generation
|
@@ -121,23 +126,108 @@ model-index:
|
|
121 |
value: 42.15
|
122 |
name: accuracy
|
123 |
source:
|
124 |
-
url:
|
|
|
125 |
name: Open LLM Leaderboard
|
126 |
---
|
127 |
|
128 |
This model is a quantized version of [`stabilityai/stablelm-zephyr-3b`](https://huggingface.co/stabilityai/stablelm-zephyr-3b) and is converted to the OpenVINO format. This model was obtained via the [nncf-quantization](https://huggingface.co/spaces/echarlaix/nncf-quantization) space with [optimum-intel](https://github.com/huggingface/optimum-intel).
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
First make sure you have `optimum-intel` installed:
|
131 |
|
132 |
```bash
|
133 |
-
pip install
|
|
|
134 |
```
|
135 |
|
136 |
To load your model you can do as follows:
|
137 |
|
138 |
```python
|
139 |
from optimum.intel import OVModelForCausalLM
|
|
|
|
|
|
|
140 |
|
141 |
model_id = "FM-1976/stablelm-zephyr-3b-openvino-4bit"
|
142 |
model = OVModelForCausalLM.from_pretrained(model_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
```
|
|
|
|
38 |
value: 46.08
|
39 |
name: normalized accuracy
|
40 |
source:
|
41 |
+
url: >-
|
42 |
+
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=stabilityai/stablelm-zephyr-3b
|
43 |
name: Open LLM Leaderboard
|
44 |
- task:
|
45 |
type: text-generation
|
|
|
55 |
value: 74.16
|
56 |
name: normalized accuracy
|
57 |
source:
|
58 |
+
url: >-
|
59 |
+
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=stabilityai/stablelm-zephyr-3b
|
60 |
name: Open LLM Leaderboard
|
61 |
- task:
|
62 |
type: text-generation
|
|
|
73 |
value: 46.17
|
74 |
name: accuracy
|
75 |
source:
|
76 |
+
url: >-
|
77 |
+
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=stabilityai/stablelm-zephyr-3b
|
78 |
name: Open LLM Leaderboard
|
79 |
- task:
|
80 |
type: text-generation
|
|
|
90 |
- type: mc2
|
91 |
value: 46.49
|
92 |
source:
|
93 |
+
url: >-
|
94 |
+
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=stabilityai/stablelm-zephyr-3b
|
95 |
name: Open LLM Leaderboard
|
96 |
- task:
|
97 |
type: text-generation
|
|
|
108 |
value: 65.51
|
109 |
name: accuracy
|
110 |
source:
|
111 |
+
url: >-
|
112 |
+
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=stabilityai/stablelm-zephyr-3b
|
113 |
name: Open LLM Leaderboard
|
114 |
- task:
|
115 |
type: text-generation
|
|
|
126 |
value: 42.15
|
127 |
name: accuracy
|
128 |
source:
|
129 |
+
url: >-
|
130 |
+
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=stabilityai/stablelm-zephyr-3b
|
131 |
name: Open LLM Leaderboard
|
132 |
---
|
133 |
|
134 |
This model is a quantized version of [`stabilityai/stablelm-zephyr-3b`](https://huggingface.co/stabilityai/stablelm-zephyr-3b) and is converted to the OpenVINO format. This model was obtained via the [nncf-quantization](https://huggingface.co/spaces/echarlaix/nncf-quantization) space with [optimum-intel](https://github.com/huggingface/optimum-intel).
|
135 |
|
136 |
+
Please note: For commercial use, please refer to https://stability.ai/license.
|
137 |
+
|
138 |
+
### Model Description
|
139 |
+
StableLM Zephyr 3B is a 3 billion parameter instruction tuned inspired by [HugginFaceH4's Zephyr 7B](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) training pipeline this model was trained on a mix of publicly available datasets, synthetic datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290), evaluation for this model based on [MT Bench](https://arxiv.org/abs/2306.05685) and [Alpaca Benchmark](https://tatsu-lab.github.io/alpaca_eval/)
|
140 |
+
|
141 |
+
|
142 |
+
### Model Parameters
|
143 |
+
```
|
144 |
+
context window = 4096
|
145 |
+
model type = 3B
|
146 |
+
model params = 2.80 B
|
147 |
+
BOS token = 0 '<|endoftext|>'
|
148 |
+
EOS token = 0 '<|endoftext|>'
|
149 |
+
UNK token = 0 '<|endoftext|>'
|
150 |
+
PAD token = 0 '<|endoftext|>'
|
151 |
+
```
|
152 |
+
The tokenizer of this model supports `chat_templates`
|
153 |
+
|
154 |
+
|
155 |
+
|
156 |
+
### Usage
|
157 |
+
StableLM Zephyr 3B uses the following instruction format:
|
158 |
+
|
159 |
+
```
|
160 |
+
<|user|>
|
161 |
+
List 3 synonyms for the word "tiny"<|endoftext|>
|
162 |
+
<|assistant|>
|
163 |
+
1. Dwarf
|
164 |
+
2. Little
|
165 |
+
3. Petite<|endoftext|>
|
166 |
+
```
|
167 |
+
|
168 |
+
### Model Details
|
169 |
+
- Developed by: Stability AI
|
170 |
+
- Model type: StableLM Zephyr 3B model is an auto-regressive language model based on the transformer decoder architecture.
|
171 |
+
- Language(s): English
|
172 |
+
- Library: [Alignment Handbook](https://github.com/huggingface/alignment-handbook.git)
|
173 |
+
- Finetuned from model: [stabilityai/stablelm-3b-4e1t](https://huggingface.co/stabilityai/stablelm-3b-4e1t)
|
174 |
+
- License: [StabilityAI Community License](https://huggingface.co/stabilityai/stablelm-zephyr-3b/raw/main/LICENSE.md).
|
175 |
+
- Commercial License: to use this model commercially, please refer to https://stability.ai/license
|
176 |
+
- Contact: For questions and comments about the model, please email [email protected]
|
177 |
+
|
178 |
+
|
179 |
First make sure you have `optimum-intel` installed:
|
180 |
|
181 |
```bash
|
182 |
+
pip install openvino-genai==2024.4.0
|
183 |
+
pip install optimum-intel[openvino]
|
184 |
```
|
185 |
|
186 |
To load your model you can do as follows:
|
187 |
|
188 |
```python
|
189 |
from optimum.intel import OVModelForCausalLM
|
190 |
+
from transformers import AutoTokenizer, AutoConfig
|
191 |
+
from threading import Thread
|
192 |
+
from transformers import TextIteratorStreamer
|
193 |
|
194 |
model_id = "FM-1976/stablelm-zephyr-3b-openvino-4bit"
|
195 |
model = OVModelForCausalLM.from_pretrained(model_id)
|
196 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
197 |
+
ov_model = OVModelForCausalLM.from_pretrained(
|
198 |
+
model_id = model_id,
|
199 |
+
device='CPU',
|
200 |
+
ov_config={"PERFORMANCE_HINT": "LATENCY", "NUM_STREAMS": "1", "CACHE_DIR": ""},
|
201 |
+
config=AutoConfig.from_pretrained(model_id)
|
202 |
+
)
|
203 |
+
|
204 |
+
|
205 |
+
# Generation with a prompt message
|
206 |
+
question = 'Explain the plot of Cinderella in a sentence.'
|
207 |
+
messages = [
|
208 |
+
{"role": "user", "content": question}
|
209 |
+
]
|
210 |
+
|
211 |
+
print('Question:', question)
|
212 |
+
#Credit to https://github.com/openvino-dev-samples/chatglm3.openvino/blob/main/chat.py
|
213 |
+
streamer = TextIteratorStreamer(tokenizer, timeout=60.0, skip_prompt=True, skip_special_tokens=True)
|
214 |
+
model_inputs = tokenizer.apply_chat_template(messages,
|
215 |
+
add_generation_prompt=True,
|
216 |
+
tokenize=True,
|
217 |
+
pad_token_id=tokenizer.eos_token_id,
|
218 |
+
num_return_sequences=1,
|
219 |
+
return_tensors="pt")
|
220 |
+
generate_kwargs = dict(input_ids=model_inputs,
|
221 |
+
max_new_tokens=450,
|
222 |
+
temperature=0.1,
|
223 |
+
do_sample=True,
|
224 |
+
top_p=0.5,
|
225 |
+
repetition_penalty=1.178,
|
226 |
+
streamer=streamer)
|
227 |
+
t1 = Thread(target=ov_model.generate, kwargs=generate_kwargs)
|
228 |
+
t1.start()
|
229 |
+
for new_text in streamer:
|
230 |
+
new_text = new_text
|
231 |
+
print(new_text, end="", flush=True)
|
232 |
```
|
233 |
+
|