Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,449 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: migtissera/Synthia-MoE-v3-Mixtral-8x7B
|
3 |
+
inference: false
|
4 |
+
license: apache-2.0
|
5 |
+
model_creator: Migel Tissera
|
6 |
+
model_name: Synthia MoE v3 Mixtral 8x7B
|
7 |
+
model_type: mixtral
|
8 |
+
prompt_template: 'SYSTEM: Elaborate on the topic using a Tree of Thoughts and backtrack
|
9 |
+
when necessary to construct a clear, cohesive Chain of Thought reasoning. Always
|
10 |
+
answer without hesitation.
|
11 |
+
|
12 |
+
USER: {prompt}
|
13 |
+
|
14 |
+
ASSISTANT:
|
15 |
+
|
16 |
+
'
|
17 |
+
quantized_by: TheBloke
|
18 |
+
---
|
19 |
+
<!-- markdownlint-disable MD041 -->
|
20 |
+
|
21 |
+
<!-- header start -->
|
22 |
+
<!-- 200823 -->
|
23 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
24 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
25 |
+
</div>
|
26 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
27 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
28 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
29 |
+
</div>
|
30 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
31 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
|
32 |
+
</div>
|
33 |
+
</div>
|
34 |
+
<div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
|
35 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
36 |
+
<!-- header end -->
|
37 |
+
|
38 |
+
# Synthia MoE v3 Mixtral 8x7B - AWQ
|
39 |
+
- Model creator: [Migel Tissera](https://huggingface.co/migtissera)
|
40 |
+
- Original model: [Synthia MoE v3 Mixtral 8x7B](https://huggingface.co/migtissera/Synthia-MoE-v3-Mixtral-8x7B)
|
41 |
+
|
42 |
+
<!-- description start -->
|
43 |
+
## Description
|
44 |
+
|
45 |
+
This repo contains AWQ model files for [Migel Tissera's Synthia MoE v3 Mixtral 8x7B](https://huggingface.co/migtissera/Synthia-MoE-v3-Mixtral-8x7B).
|
46 |
+
|
47 |
+
|
48 |
+
**MIXTRAL AWQ**
|
49 |
+
|
50 |
+
This is a Mixtral AWQ model.
|
51 |
+
|
52 |
+
For AutoAWQ inference, please install AutoAWQ from source.
|
53 |
+
|
54 |
+
Support via Transformers is coming soon, via this PR: https://github.com/huggingface/transformers/pull/27950 which should be merged to Transformers `main` very soon.
|
55 |
+
|
56 |
+
Support via vLLM and TGI has not yet been confirmed.
|
57 |
+
|
58 |
+
### About AWQ
|
59 |
+
|
60 |
+
AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference with equivalent or better quality compared to the most commonly used GPTQ settings.
|
61 |
+
|
62 |
+
AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
|
63 |
+
|
64 |
+
AWQ models are supported by (note that not all of these may support Mixtral models yet):
|
65 |
+
|
66 |
+
- [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
|
67 |
+
- [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
|
68 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
|
69 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
|
70 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
|
71 |
+
|
72 |
+
<!-- description end -->
|
73 |
+
<!-- repositories-available start -->
|
74 |
+
## Repositories available
|
75 |
+
|
76 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ)
|
77 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Synthia-MoE-v3-Mixtral-8x7B-GPTQ)
|
78 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Synthia-MoE-v3-Mixtral-8x7B-GGUF)
|
79 |
+
* [Migel Tissera's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/migtissera/Synthia-MoE-v3-Mixtral-8x7B)
|
80 |
+
<!-- repositories-available end -->
|
81 |
+
|
82 |
+
<!-- prompt-template start -->
|
83 |
+
## Prompt template: Synthia-CoT
|
84 |
+
|
85 |
+
```
|
86 |
+
SYSTEM: Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.
|
87 |
+
USER: {prompt}
|
88 |
+
ASSISTANT:
|
89 |
+
|
90 |
+
```
|
91 |
+
|
92 |
+
<!-- prompt-template end -->
|
93 |
+
|
94 |
+
|
95 |
+
<!-- README_AWQ.md-provided-files start -->
|
96 |
+
## Provided files, and AWQ parameters
|
97 |
+
|
98 |
+
I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
|
99 |
+
|
100 |
+
Models are released as sharded safetensors files.
|
101 |
+
|
102 |
+
| Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
|
103 |
+
| ------ | ---- | -- | ----------- | ------- | ---- |
|
104 |
+
| [main](https://huggingface.co/TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 24.65 GB
|
105 |
+
|
106 |
+
<!-- README_AWQ.md-provided-files end -->
|
107 |
+
|
108 |
+
<!-- README_AWQ.md-text-generation-webui start -->
|
109 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
110 |
+
|
111 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
112 |
+
|
113 |
+
It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
|
114 |
+
|
115 |
+
1. Click the **Model tab**.
|
116 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ`.
|
117 |
+
3. Click **Download**.
|
118 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
119 |
+
5. In the top left, click the refresh icon next to **Model**.
|
120 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `Synthia-MoE-v3-Mixtral-8x7B-AWQ`
|
121 |
+
7. Select **Loader: AutoAWQ**.
|
122 |
+
8. Click Load, and the model will load and is now ready for use.
|
123 |
+
9. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
|
124 |
+
10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
|
125 |
+
<!-- README_AWQ.md-text-generation-webui end -->
|
126 |
+
|
127 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
128 |
+
## Multi-user inference server: vLLM
|
129 |
+
|
130 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
131 |
+
|
132 |
+
- Please ensure you are using vLLM version 0.2 or later.
|
133 |
+
- When using vLLM as a server, pass the `--quantization awq` parameter.
|
134 |
+
|
135 |
+
For example:
|
136 |
+
|
137 |
+
```shell
|
138 |
+
python3 -m vllm.entrypoints.api_server --model TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ --quantization awq --dtype auto
|
139 |
+
```
|
140 |
+
|
141 |
+
- When using vLLM from Python code, again set `quantization=awq`.
|
142 |
+
|
143 |
+
For example:
|
144 |
+
|
145 |
+
```python
|
146 |
+
from vllm import LLM, SamplingParams
|
147 |
+
|
148 |
+
prompts = [
|
149 |
+
"Tell me about AI",
|
150 |
+
"Write a story about llamas",
|
151 |
+
"What is 291 - 150?",
|
152 |
+
"How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
|
153 |
+
]
|
154 |
+
prompt_template=f'''SYSTEM: Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.
|
155 |
+
USER: {prompt}
|
156 |
+
ASSISTANT:
|
157 |
+
'''
|
158 |
+
|
159 |
+
prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
|
160 |
+
|
161 |
+
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
|
162 |
+
|
163 |
+
llm = LLM(model="TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ", quantization="awq", dtype="auto")
|
164 |
+
|
165 |
+
outputs = llm.generate(prompts, sampling_params)
|
166 |
+
|
167 |
+
# Print the outputs.
|
168 |
+
for output in outputs:
|
169 |
+
prompt = output.prompt
|
170 |
+
generated_text = output.outputs[0].text
|
171 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
172 |
+
```
|
173 |
+
<!-- README_AWQ.md-use-from-vllm start -->
|
174 |
+
|
175 |
+
<!-- README_AWQ.md-use-from-tgi start -->
|
176 |
+
## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
|
177 |
+
|
178 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
179 |
+
|
180 |
+
Example Docker parameters:
|
181 |
+
|
182 |
+
```shell
|
183 |
+
--model-id TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
|
184 |
+
```
|
185 |
+
|
186 |
+
Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
|
187 |
+
|
188 |
+
```shell
|
189 |
+
pip3 install huggingface-hub
|
190 |
+
```
|
191 |
+
|
192 |
+
```python
|
193 |
+
from huggingface_hub import InferenceClient
|
194 |
+
|
195 |
+
endpoint_url = "https://your-endpoint-url-here"
|
196 |
+
|
197 |
+
prompt = "Tell me about AI"
|
198 |
+
prompt_template=f'''SYSTEM: Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.
|
199 |
+
USER: {prompt}
|
200 |
+
ASSISTANT:
|
201 |
+
'''
|
202 |
+
|
203 |
+
client = InferenceClient(endpoint_url)
|
204 |
+
response = client.text_generation(prompt,
|
205 |
+
max_new_tokens=128,
|
206 |
+
do_sample=True,
|
207 |
+
temperature=0.7,
|
208 |
+
top_p=0.95,
|
209 |
+
top_k=40,
|
210 |
+
repetition_penalty=1.1)
|
211 |
+
|
212 |
+
print(f"Model output: ", response)
|
213 |
+
```
|
214 |
+
<!-- README_AWQ.md-use-from-tgi end -->
|
215 |
+
|
216 |
+
<!-- README_AWQ.md-use-from-python start -->
|
217 |
+
## Inference from Python code using Transformers
|
218 |
+
|
219 |
+
### Install the necessary packages
|
220 |
+
|
221 |
+
- Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
|
222 |
+
- Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
|
223 |
+
|
224 |
+
```shell
|
225 |
+
pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
|
226 |
+
```
|
227 |
+
|
228 |
+
Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
|
229 |
+
|
230 |
+
If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
|
231 |
+
|
232 |
+
```shell
|
233 |
+
pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
|
234 |
+
```
|
235 |
+
|
236 |
+
If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
|
237 |
+
|
238 |
+
```shell
|
239 |
+
pip3 uninstall -y autoawq
|
240 |
+
git clone https://github.com/casper-hansen/AutoAWQ
|
241 |
+
cd AutoAWQ
|
242 |
+
pip3 install .
|
243 |
+
```
|
244 |
+
|
245 |
+
### Transformers example code (requires Transformers 4.35.0 and later)
|
246 |
+
|
247 |
+
```python
|
248 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
249 |
+
|
250 |
+
model_name_or_path = "TheBloke/Synthia-MoE-v3-Mixtral-8x7B-AWQ"
|
251 |
+
|
252 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
253 |
+
model = AutoModelForCausalLM.from_pretrained(
|
254 |
+
model_name_or_path,
|
255 |
+
low_cpu_mem_usage=True,
|
256 |
+
device_map="cuda:0"
|
257 |
+
)
|
258 |
+
|
259 |
+
# Using the text streamer to stream output one token at a time
|
260 |
+
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
261 |
+
|
262 |
+
prompt = "Tell me about AI"
|
263 |
+
prompt_template=f'''SYSTEM: Elaborate on the topic using a Tree of Thoughts and backtrack when necessary to construct a clear, cohesive Chain of Thought reasoning. Always answer without hesitation.
|
264 |
+
USER: {prompt}
|
265 |
+
ASSISTANT:
|
266 |
+
'''
|
267 |
+
|
268 |
+
# Convert prompt to tokens
|
269 |
+
tokens = tokenizer(
|
270 |
+
prompt_template,
|
271 |
+
return_tensors='pt'
|
272 |
+
).input_ids.cuda()
|
273 |
+
|
274 |
+
generation_params = {
|
275 |
+
"do_sample": True,
|
276 |
+
"temperature": 0.7,
|
277 |
+
"top_p": 0.95,
|
278 |
+
"top_k": 40,
|
279 |
+
"max_new_tokens": 512,
|
280 |
+
"repetition_penalty": 1.1
|
281 |
+
}
|
282 |
+
|
283 |
+
# Generate streamed output, visible one token at a time
|
284 |
+
generation_output = model.generate(
|
285 |
+
tokens,
|
286 |
+
streamer=streamer,
|
287 |
+
**generation_params
|
288 |
+
)
|
289 |
+
|
290 |
+
# Generation without a streamer, which will include the prompt in the output
|
291 |
+
generation_output = model.generate(
|
292 |
+
tokens,
|
293 |
+
**generation_params
|
294 |
+
)
|
295 |
+
|
296 |
+
# Get the tokens from the output, decode them, print them
|
297 |
+
token_output = generation_output[0]
|
298 |
+
text_output = tokenizer.decode(token_output)
|
299 |
+
print("model.generate output: ", text_output)
|
300 |
+
|
301 |
+
# Inference is also possible via Transformers' pipeline
|
302 |
+
from transformers import pipeline
|
303 |
+
|
304 |
+
pipe = pipeline(
|
305 |
+
"text-generation",
|
306 |
+
model=model,
|
307 |
+
tokenizer=tokenizer,
|
308 |
+
**generation_params
|
309 |
+
)
|
310 |
+
|
311 |
+
pipe_output = pipe(prompt_template)[0]['generated_text']
|
312 |
+
print("pipeline output: ", pipe_output)
|
313 |
+
|
314 |
+
```
|
315 |
+
<!-- README_AWQ.md-use-from-python end -->
|
316 |
+
|
317 |
+
<!-- README_AWQ.md-compatibility start -->
|
318 |
+
## Compatibility
|
319 |
+
|
320 |
+
The files provided are tested to work with:
|
321 |
+
|
322 |
+
- [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
|
323 |
+
- [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
|
324 |
+
- [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
|
325 |
+
- [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
|
326 |
+
- [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
|
327 |
+
|
328 |
+
<!-- README_AWQ.md-compatibility end -->
|
329 |
+
|
330 |
+
<!-- footer start -->
|
331 |
+
<!-- 200823 -->
|
332 |
+
## Discord
|
333 |
+
|
334 |
+
For further support, and discussions on these models and AI in general, join us at:
|
335 |
+
|
336 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
337 |
+
|
338 |
+
## Thanks, and how to contribute
|
339 |
+
|
340 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
341 |
+
|
342 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
343 |
+
|
344 |
+
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
|
345 |
+
|
346 |
+
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
|
347 |
+
|
348 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
349 |
+
|
350 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
351 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
352 |
+
|
353 |
+
**Special thanks to**: Aemon Algiz.
|
354 |
+
|
355 |
+
**Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
|
356 |
+
|
357 |
+
|
358 |
+
Thank you to all my generous patrons and donaters!
|
359 |
+
|
360 |
+
And thank you again to a16z for their generous grant.
|
361 |
+
|
362 |
+
<!-- footer end -->
|
363 |
+
|
364 |
+
# Original model card: Migel Tissera's Synthia MoE v3 Mixtral 8x7B
|
365 |
+
|
366 |
+
|
367 |
+
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|
368 |
+
|
369 |
+
# Note:
|
370 |
+
Model is most likely over-fitted due to higher learning rate. Will fix this issue in the next release.
|
371 |
+
|
372 |
+
# Synthia-MoE-v3-Mixtral-8x7B
|
373 |
+
|
374 |
+
This is Synthia-MoE-v3 trained on the official Mistral MoE version (Mixtral-8x7B).
|
375 |
+
|
376 |
+
This model is trained on the Synthia-v3.0 dataset, that contains ~10K super high-quality GPT-4-Turbo generated samples. The samples contains Tree-of-Thought, Chain-of-Thought and other system contexts designed to evoke reasoning, philosophical thinking, use working memory and long chain of reasoning with multi-part questions.
|
377 |
+
|
378 |
+
Further, this model is trained on the Orca-2 principle of replacing the system context with just one message. In the case of this Synthia-MoE-v3 model, the system context was not included at all.
|
379 |
+
|
380 |
+
The evals are coming, but testing empirically the model produces highly intelligent, coherent results. Here's a sample conversation: https://migel.substack.com/p/a-conversation-with-synthia-moe-mixtral
|
381 |
+
|
382 |
+
<br>
|
383 |
+
|
384 |
+
![Synthia](https://huggingface.co/migtissera/Synthia-MoE-v3-Mixtral-8x7B/resolve/main/Synthia-MoE.png)
|
385 |
+
|
386 |
+
<br>
|
387 |
+
|
388 |
+
```
|
389 |
+
import torch, json
|
390 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
391 |
+
|
392 |
+
model_path = "/home/Synthia-MoE-v3-Mixtral8x7B"
|
393 |
+
output_file_path = "/home/conversations.jsonl"
|
394 |
+
|
395 |
+
model = AutoModelForCausalLM.from_pretrained(
|
396 |
+
model_path,
|
397 |
+
torch_dtype=torch.float16,
|
398 |
+
device_map="auto",
|
399 |
+
load_in_4bit=False,
|
400 |
+
trust_remote_code=True,
|
401 |
+
)
|
402 |
+
|
403 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
404 |
+
|
405 |
+
def generate_text(instruction):
|
406 |
+
tokens = tokenizer.encode(instruction)
|
407 |
+
tokens = torch.LongTensor(tokens).unsqueeze(0)
|
408 |
+
tokens = tokens.to("cuda")
|
409 |
+
|
410 |
+
instance = {
|
411 |
+
"input_ids": tokens,
|
412 |
+
"top_p": 1.0,
|
413 |
+
"temperature": 0.75,
|
414 |
+
"generate_len": 1024,
|
415 |
+
"top_k": 50,
|
416 |
+
}
|
417 |
+
|
418 |
+
length = len(tokens[0])
|
419 |
+
with torch.no_grad():
|
420 |
+
rest = model.generate(
|
421 |
+
input_ids=tokens,
|
422 |
+
max_length=length + instance["generate_len"],
|
423 |
+
use_cache=True,
|
424 |
+
do_sample=True,
|
425 |
+
top_p=instance["top_p"],
|
426 |
+
temperature=instance["temperature"],
|
427 |
+
top_k=instance["top_k"],
|
428 |
+
num_return_sequences=1,
|
429 |
+
)
|
430 |
+
output = rest[0][length:]
|
431 |
+
string = tokenizer.decode(output, skip_special_tokens=True)
|
432 |
+
answer = string.split("USER:")[0].strip()
|
433 |
+
return f"{answer}"
|
434 |
+
|
435 |
+
conversation = "SYSTEM: Answer the question thoughtfully and intelligently. Always answer without hesitation."
|
436 |
+
|
437 |
+
while True:
|
438 |
+
user_input = input("You: ")
|
439 |
+
llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
|
440 |
+
answer = generate_text(llm_prompt)
|
441 |
+
print(answer)
|
442 |
+
conversation = f"{llm_prompt}{answer}"
|
443 |
+
json_data = {"prompt": user_input, "answer": answer}
|
444 |
+
|
445 |
+
with open(output_file_path, "a") as output_file:
|
446 |
+
output_file.write(json.dumps(json_data) + "\n")
|
447 |
+
```
|
448 |
+
|
449 |
+
|