TheBloke commited on
Commit
9df2f3d
1 Parent(s): 6a82fa4

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +389 -0
README.md ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: TomGrc/FusionNet_34Bx2_MoE
3
+ inference: false
4
+ language:
5
+ - en
6
+ license: mit
7
+ model_creator: Suqin Zhang
8
+ model_name: FusionNet 34Bx2 MoE
9
+ model_type: mixtral
10
+ pipeline_tag: text-generation
11
+ prompt_template: '[INST] <<SYS>>
12
+
13
+ {system_message}
14
+
15
+ <</SYS>>
16
+
17
+ {prompt} [/INST]
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ tags:
22
+ - moe
23
+ ---
24
+ <!-- markdownlint-disable MD041 -->
25
+
26
+ <!-- header start -->
27
+ <!-- 200823 -->
28
+ <div style="width: auto; margin-left: auto; margin-right: auto">
29
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
30
+ </div>
31
+ <div style="display: flex; justify-content: space-between; width: 100%;">
32
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
34
+ </div>
35
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
36
+ <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>
37
+ </div>
38
+ </div>
39
+ <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>
40
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
41
+ <!-- header end -->
42
+
43
+ # FusionNet 34Bx2 MoE - AWQ
44
+ - Model creator: [Suqin Zhang](https://huggingface.co/TomGrc)
45
+ - Original model: [FusionNet 34Bx2 MoE](https://huggingface.co/TomGrc/FusionNet_34Bx2_MoE)
46
+
47
+ <!-- description start -->
48
+ ## Description
49
+
50
+ This repo contains AWQ model files for [Suqin Zhang's FusionNet 34Bx2 MoE](https://huggingface.co/TomGrc/FusionNet_34Bx2_MoE).
51
+
52
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
53
+
54
+
55
+ **MIXTRAL AWQ**
56
+
57
+ This is a Mixtral AWQ model.
58
+
59
+ For AutoAWQ inference, please install AutoAWQ 0.1.8 or later.
60
+
61
+ Support via Transformers is also available, but currently requires installing Transformers from Github: `pip3 install git+https://github.com/huggingface/transformers.git`
62
+
63
+ vLLM: version 0.2.6 is confirmed to support Mixtral AWQs.
64
+
65
+ TGI: I tested version 1.3.3 and it loaded the model fine, but I was not able to get any output back. Further testing/debug is required. (Let me know if you get it working!)
66
+
67
+ ### About AWQ
68
+
69
+ 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.
70
+
71
+ AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
72
+
73
+ AWQ models are supported by (note that not all of these may support Mixtral models yet - see above):
74
+
75
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
76
+ - [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
77
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
78
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
79
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
80
+
81
+ <!-- description end -->
82
+ <!-- repositories-available start -->
83
+ ## Repositories available
84
+
85
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/FusionNet_34Bx2_MoE-AWQ)
86
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/FusionNet_34Bx2_MoE-GPTQ)
87
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/FusionNet_34Bx2_MoE-GGUF)
88
+ * [Suqin Zhang's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/TomGrc/FusionNet_34Bx2_MoE)
89
+ <!-- repositories-available end -->
90
+
91
+ <!-- prompt-template start -->
92
+ ## Prompt template: Llama-2-Chat
93
+
94
+ ```
95
+ [INST] <<SYS>>
96
+ {system_message}
97
+ <</SYS>>
98
+ {prompt} [/INST]
99
+
100
+ ```
101
+
102
+ <!-- prompt-template end -->
103
+
104
+
105
+ <!-- README_AWQ.md-provided-files start -->
106
+ ## Provided files, and AWQ parameters
107
+
108
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
109
+
110
+ Models are released as sharded safetensors files.
111
+
112
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
113
+ | ------ | ---- | -- | ----------- | ------- | ---- |
114
+ | [main](https://huggingface.co/TheBloke/FusionNet_34Bx2_MoE-AWQ/tree/main) | 4 | 128 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 32.96 GB
115
+
116
+ <!-- README_AWQ.md-provided-files end -->
117
+
118
+ <!-- README_AWQ.md-text-generation-webui start -->
119
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
120
+
121
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
122
+
123
+ 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.
124
+
125
+ 1. Click the **Model tab**.
126
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/FusionNet_34Bx2_MoE-AWQ`.
127
+ 3. Click **Download**.
128
+ 4. The model will start downloading. Once it's finished it will say "Done".
129
+ 5. In the top left, click the refresh icon next to **Model**.
130
+ 6. In the **Model** dropdown, choose the model you just downloaded: `FusionNet_34Bx2_MoE-AWQ`
131
+ 7. Select **Loader: AutoAWQ**.
132
+ 8. Click Load, and the model will load and is now ready for use.
133
+ 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.
134
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
135
+ <!-- README_AWQ.md-text-generation-webui end -->
136
+
137
+ <!-- README_AWQ.md-use-from-vllm start -->
138
+ ## Multi-user inference server: vLLM
139
+
140
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
141
+
142
+ - Please ensure you are using vLLM version 0.2 or later.
143
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
144
+
145
+ For example:
146
+
147
+ ```shell
148
+ python3 -m vllm.entrypoints.api_server --model TheBloke/FusionNet_34Bx2_MoE-AWQ --quantization awq --dtype auto
149
+ ```
150
+
151
+ - When using vLLM from Python code, again set `quantization=awq`.
152
+
153
+ For example:
154
+
155
+ ```python
156
+ from vllm import LLM, SamplingParams
157
+
158
+ prompts = [
159
+ "Tell me about AI",
160
+ "Write a story about llamas",
161
+ "What is 291 - 150?",
162
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
163
+ ]
164
+ prompt_template=f'''[INST] <<SYS>>
165
+ {system_message}
166
+ <</SYS>>
167
+ {prompt} [/INST]
168
+ '''
169
+
170
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
171
+
172
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
173
+
174
+ llm = LLM(model="TheBloke/FusionNet_34Bx2_MoE-AWQ", quantization="awq", dtype="auto")
175
+
176
+ outputs = llm.generate(prompts, sampling_params)
177
+
178
+ # Print the outputs.
179
+ for output in outputs:
180
+ prompt = output.prompt
181
+ generated_text = output.outputs[0].text
182
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
183
+ ```
184
+ <!-- README_AWQ.md-use-from-vllm start -->
185
+
186
+ <!-- README_AWQ.md-use-from-tgi start -->
187
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
188
+
189
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
190
+
191
+ Example Docker parameters:
192
+
193
+ ```shell
194
+ --model-id TheBloke/FusionNet_34Bx2_MoE-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
195
+ ```
196
+
197
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
198
+
199
+ ```shell
200
+ pip3 install huggingface-hub
201
+ ```
202
+
203
+ ```python
204
+ from huggingface_hub import InferenceClient
205
+
206
+ endpoint_url = "https://your-endpoint-url-here"
207
+
208
+ prompt = "Tell me about AI"
209
+ prompt_template=f'''[INST] <<SYS>>
210
+ {system_message}
211
+ <</SYS>>
212
+ {prompt} [/INST]
213
+ '''
214
+
215
+ client = InferenceClient(endpoint_url)
216
+ response = client.text_generation(prompt,
217
+ max_new_tokens=128,
218
+ do_sample=True,
219
+ temperature=0.7,
220
+ top_p=0.95,
221
+ top_k=40,
222
+ repetition_penalty=1.1)
223
+
224
+ print(f"Model output: ", response)
225
+ ```
226
+ <!-- README_AWQ.md-use-from-tgi end -->
227
+
228
+ <!-- README_AWQ.md-use-from-python start -->
229
+ ## Inference from Python code using Transformers
230
+
231
+ ### Install the necessary packages
232
+
233
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
234
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
235
+
236
+ ```shell
237
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
238
+ ```
239
+
240
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
241
+
242
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
243
+
244
+ ```shell
245
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
246
+ ```
247
+
248
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
249
+
250
+ ```shell
251
+ pip3 uninstall -y autoawq
252
+ git clone https://github.com/casper-hansen/AutoAWQ
253
+ cd AutoAWQ
254
+ pip3 install .
255
+ ```
256
+
257
+ ### Transformers example code (requires Transformers 4.35.0 and later)
258
+
259
+ ```python
260
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
261
+
262
+ model_name_or_path = "TheBloke/FusionNet_34Bx2_MoE-AWQ"
263
+
264
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
265
+ model = AutoModelForCausalLM.from_pretrained(
266
+ model_name_or_path,
267
+ low_cpu_mem_usage=True,
268
+ device_map="cuda:0"
269
+ )
270
+
271
+ # Using the text streamer to stream output one token at a time
272
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
273
+
274
+ prompt = "Tell me about AI"
275
+ prompt_template=f'''[INST] <<SYS>>
276
+ {system_message}
277
+ <</SYS>>
278
+ {prompt} [/INST]
279
+ '''
280
+
281
+ # Convert prompt to tokens
282
+ tokens = tokenizer(
283
+ prompt_template,
284
+ return_tensors='pt'
285
+ ).input_ids.cuda()
286
+
287
+ generation_params = {
288
+ "do_sample": True,
289
+ "temperature": 0.7,
290
+ "top_p": 0.95,
291
+ "top_k": 40,
292
+ "max_new_tokens": 512,
293
+ "repetition_penalty": 1.1
294
+ }
295
+
296
+ # Generate streamed output, visible one token at a time
297
+ generation_output = model.generate(
298
+ tokens,
299
+ streamer=streamer,
300
+ **generation_params
301
+ )
302
+
303
+ # Generation without a streamer, which will include the prompt in the output
304
+ generation_output = model.generate(
305
+ tokens,
306
+ **generation_params
307
+ )
308
+
309
+ # Get the tokens from the output, decode them, print them
310
+ token_output = generation_output[0]
311
+ text_output = tokenizer.decode(token_output)
312
+ print("model.generate output: ", text_output)
313
+
314
+ # Inference is also possible via Transformers' pipeline
315
+ from transformers import pipeline
316
+
317
+ pipe = pipeline(
318
+ "text-generation",
319
+ model=model,
320
+ tokenizer=tokenizer,
321
+ **generation_params
322
+ )
323
+
324
+ pipe_output = pipe(prompt_template)[0]['generated_text']
325
+ print("pipeline output: ", pipe_output)
326
+
327
+ ```
328
+ <!-- README_AWQ.md-use-from-python end -->
329
+
330
+ <!-- README_AWQ.md-compatibility start -->
331
+ ## Compatibility
332
+
333
+ The files provided are tested to work with:
334
+
335
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
336
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
337
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
338
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
339
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
340
+
341
+ <!-- README_AWQ.md-compatibility end -->
342
+
343
+ <!-- footer start -->
344
+ <!-- 200823 -->
345
+ ## Discord
346
+
347
+ For further support, and discussions on these models and AI in general, join us at:
348
+
349
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
350
+
351
+ ## Thanks, and how to contribute
352
+
353
+ Thanks to the [chirper.ai](https://chirper.ai) team!
354
+
355
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
356
+
357
+ 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.
358
+
359
+ 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.
360
+
361
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
362
+
363
+ * Patreon: https://patreon.com/TheBlokeAI
364
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
365
+
366
+ **Special thanks to**: Aemon Algiz.
367
+
368
+ **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
369
+
370
+
371
+ Thank you to all my generous patrons and donaters!
372
+
373
+ And thank you again to a16z for their generous grant.
374
+
375
+ <!-- footer end -->
376
+
377
+ # Original model card: Suqin Zhang's FusionNet 34Bx2 MoE
378
+
379
+ # FusionNet_34Bx2_MoE
380
+ Fine-tuned model on English language using MoE method.
381
+ ## Model description
382
+ The FusionNet_34Bx2_MoE is a model to experiment with the MoE method, which could significantly increase the performance of the original model. The FusionNet_34Bx2_MoE has 60.8B parameters, and this model is fine-tuned. Enjoy!
383
+ ## Usage
384
+ ```python
385
+ import torch
386
+ from transformers import AutoModelForCausalLM, AutoTokenizer
387
+ tokenizer = AutoTokenizer.from_pretrained("TomGrc/FusionNet_34Bx2_MoE")
388
+ model = AutoModelForCausalLM.from_pretrained("TomGrc/FusionNet_34Bx2_MoE")
389
+ ```