Transformers
mpt
Composer
MosaicML
llm-foundry
text-generation-inference
TheBloke commited on
Commit
ebfe7f8
1 Parent(s): 1518798

Initial GGML model commit

Browse files
Files changed (1) hide show
  1. README.md +334 -0
README.md ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ inference: false
3
+ license: other
4
+ ---
5
+
6
+ <!-- header start -->
7
+ <div style="width: 100%;">
8
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
9
+ </div>
10
+ <div style="display: flex; justify-content: space-between; width: 100%;">
11
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
12
+ <p><a href="https://discord.gg/Jq4vkcDakD">Chat & support: my new Discord server</a></p>
13
+ </div>
14
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
15
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
16
+ </div>
17
+ </div>
18
+ <!-- header end -->
19
+
20
+ # MosaicML's MPT-30B-chat GGML
21
+
22
+ These files are GGML format model files for [MosaicML's MPT-30B-chat](https://huggingface.co/mosaicml/mpt-30b-chat).
23
+
24
+ GGML files are for CPU + GPU inference using [llama.cpp](https://github.com/ggerganov/llama.cpp) and libraries and UIs which support this format, such as:
25
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
26
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp)
27
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
28
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)
29
+ * [ctransformers](https://github.com/marella/ctransformers)
30
+
31
+ ## Repositories available
32
+
33
+ * [4-bit GPTQ models for GPU inference](https://huggingface.co/none)
34
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/mpt-30B-chat-GGML)
35
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/mosaicml/mpt-30b-chat)
36
+
37
+ <!-- compatibility_ggml start -->
38
+ ## Compatibility
39
+
40
+ ### Original llama.cpp quant methods: `q4_0, q4_1, q5_0, q5_1, q8_0`
41
+
42
+ I have quantized these 'original' quantisation methods using an older version of llama.cpp so that they remain compatible with llama.cpp as of May 19th, commit `2d5db48`.
43
+
44
+ These are guaranteed to be compatbile with any UIs, tools and libraries released since late May.
45
+
46
+ ### New k-quant methods: `q2_K, q3_K_S, q3_K_M, q3_K_L, q4_K_S, q4_K_M, q5_K_S, q6_K`
47
+
48
+ These new quantisation methods are compatible with llama.cpp as of June 6th, commit `2d43387`.
49
+
50
+ They are now also compatible with recent releases of text-generation-webui, KoboldCpp, llama-cpp-python and ctransformers. Other tools and libraries may or may not be compatible - check their documentation if in doubt.
51
+
52
+ ## Explanation of the new k-quant methods
53
+
54
+ The new methods available are:
55
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
56
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
57
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
58
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
59
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
60
+ * GGML_TYPE_Q8_K - "type-0" 8-bit quantization. Only used for quantizing intermediate results. The difference to the existing Q8_0 is that the block size is 256. All 2-6 bit dot products are implemented for this quantization type.
61
+
62
+ Refer to the Provided Files table below to see what files use which methods, and how.
63
+ <!-- compatibility_ggml end -->
64
+
65
+ ## Provided files
66
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
67
+ | ---- | ---- | ---- | ---- | ---- | ----- |
68
+ | mpt-30b-chat.ggmlv0.q4_0.bin | q4_0 | 4 | 16.85 GB | 19.35 GB | Original llama.cpp quant method, 4-bit. |
69
+ | mpt-30b-chat.ggmlv0.q4_1.bin | q4_1 | 4 | 18.73 GB | 21.23 GB | Original llama.cpp quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
70
+ | mpt-30b-chat.ggmlv0.q5_0.bin | q5_0 | 5 | 20.60 GB | 23.10 GB | Original llama.cpp quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. |
71
+ | mpt-30b-chat.ggmlv0.q5_1.bin | q5_1 | 5 | 22.47 GB | 24.97 GB | Original llama.cpp quant method, 5-bit. Even higher accuracy, resource usage and slower inference. |
72
+ | mpt-30b-chat.ggmlv0.q8_0.bin | q8_0 | 8 | 31.83 GB | 34.33 GB | Original llama.cpp quant method, 8-bit. Almost indistinguishable from float16. High resource use and slow. Not recommended for most users. |
73
+
74
+ **Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
75
+
76
+ ## How to run in `llama.cpp`
77
+
78
+ I use the following command line; adjust for your tastes and needs:
79
+
80
+ ```
81
+ ./main -t 10 -ngl 32 -m mpt-30b-chat.ggmlv3.q5_0.bin --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "### Instruction: Write a story about llamas\n### Response:"
82
+ ```
83
+ If you're able to use full GPU offloading, you should use `-t 1` to get best performance.
84
+
85
+ If not able to fully offload to GPU, you should use more cores. Change `-t 10` to the number of physical CPU cores you have, or a lower number depending on what gives best performance.
86
+
87
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
88
+
89
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
90
+
91
+ ## How to run in `text-generation-webui`
92
+
93
+ Further instructions here: [text-generation-webui/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md).
94
+
95
+ <!-- footer start -->
96
+ ## Discord
97
+
98
+ For further support, and discussions on these models and AI in general, join us at:
99
+
100
+ [TheBloke AI's Discord server](https://discord.gg/Jq4vkcDakD)
101
+
102
+ ## Thanks, and how to contribute.
103
+
104
+ Thanks to the [chirper.ai](https://chirper.ai) team!
105
+
106
+ 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.
107
+
108
+ 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.
109
+
110
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
111
+
112
+ * Patreon: https://patreon.com/TheBlokeAI
113
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
114
+
115
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz, Dmitriy Samsonov.
116
+
117
+ **Patreon special mentions**: Mano Prime, Fen Risland, Derek Yates, Preetika Verma, webtim, Sean Connelly, Alps Aficionado, Karl Bernard, Junyu Yang, Nathan LeClaire, Chris McCloskey, Lone Striker, Asp the Wyvern, Eugene Pentland, Imad Khwaja, trip7s trip, WelcomeToTheClub, John Detwiler, Artur Olbinski, Khalefa Al-Ahmad, Trenton Dambrowitz, Talal Aujan, Kevin Schuppel, Luke Pendergrass, Pyrater, Joseph William Delisle, terasurfer , vamX, Gabriel Puliatti, David Flickinger, Jonathan Leane, Iucharbius , Luke, Deep Realms, Cory Kujawski, ya boyyy, Illia Dulskyi, senxiiz, Johann-Peter Hartmann, John Villwock, K, Ghost , Spiking Neurons AB, Nikolai Manek, Rainer Wilmers, Pierre Kircher, biorpg, Space Cruiser, Ai Maven, subjectnull, Willem Michiel, Ajan Kanaga, Kalila, chris gileta, Oscar Rangel.
118
+
119
+ Thank you to all my generous patrons and donaters!
120
+
121
+ <!-- footer end -->
122
+
123
+ # Original model card: MosaicML's MPT-30B-chat
124
+
125
+
126
+ # MPT-30B-Chat
127
+
128
+ MPT-30B-Chat is a chatbot-like model for dialogue generation.
129
+ It was built by finetuning [MPT-30B](https://huggingface.co/mosaicml/mpt-30b) on the [ShareGPT-Vicuna](https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered), [Camel-AI](https://huggingface.co/camel-ai),
130
+ [GPTeacher](https://github.com/teknium1/GPTeacher), [Guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco), [Baize](https://github.com/project-baize/baize-chatbot) and some generated datasets.
131
+ * License: _CC-By-NC-SA-4.0_ (non-commercial use only)
132
+ * [Demo on Hugging Face Spaces](https://huggingface.co/spaces/mosaicml/mpt-30b-chat)
133
+
134
+
135
+ This model was trained by [MosaicML](https://www.mosaicml.com) and follows a modified decoder-only transformer architecture.
136
+
137
+ ## Model Date
138
+
139
+ June 22, 2023
140
+
141
+ ## Model License
142
+
143
+ _CC-By-NC-SA-4.0_ (non-commercial use only)
144
+
145
+ ## Documentation
146
+
147
+ * [Blog post: Raising the bar for open-source foundation models](https://www.mosaicml.com/blog/mpt-30b)
148
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
149
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://mosaicml.me/slack)!
150
+
151
+ ### Example Dialogue
152
+
153
+ **ksreenivasan**:
154
+ > I want you to come up with a tweet based on this summary of the article:
155
+ >
156
+ > We are excited to extend the MosaicML Foundation Series with MPT-30B, a new commercially licensed open-source model that is significantly more powerful, and outperforms the
157
+ > original GPT-3. In addition, we are releasing two fine-tuned models, MPT-30B-Instruct and MPT-30B-Chat, that are built on top of MPT-30B and excel at short-form instruction
158
+ > following and multi-turn conversations, respectively.
159
+ > All MPT-30B models come with special features that differentiate them from other LLMs, including an 8k token context window (which can be further extended via finetuning;
160
+ > see MPT-7B-StoryWriter), support for context-length extrapolation via ALiBi, and efficient inference + training performance via FlashAttention. It also has strong coding
161
+ > abilities thanks to its pretraining data mixture.
162
+
163
+
164
+
165
+ **MPT-30B-Chat**:
166
+ > "Revolutionize your AI capabilities with MosaicML's latest addition, MPT-30B! Outperforming GPT-3, this open-source model is significantly more powerful and comes with
167
+ > finely-tuned models for exceptional instruction following and multi-turn conversations. Unleash the potential of an 8k token context window, ALiBi support, and FlashAttention.
168
+ > Experience the future of AI with MosaicML! #AI #ML #innovation"
169
+
170
+ **ksreenivasan**:
171
+ > Is there anything you want to say to MosaicML about this exciting news?
172
+
173
+ **MPT-30B-Chat**:
174
+ > As your AI marketing assistant, I would say that this is truly exciting news for the AI community! MosaicML's latest addition, MPT-30B, is poised to revolutionize the industry with its powerful open-source capabilities and finely-tuned models for instruction following and multi-turn conversations.
175
+ > The special features, including the 8k token context window, ALiBi support, and FlashAttention, are sure to set MosaicML's MPT-30B apart from other LLMs.
176
+ > Congratulations to the MosaicML team on this incredible achievement!
177
+
178
+ ## How to Use
179
+
180
+ This model is best used with the MosaicML [llm-foundry repository](https://github.com/mosaicml/llm-foundry) for training and finetuning.
181
+
182
+ ```python
183
+ import transformers
184
+ model = transformers.AutoModelForCausalLM.from_pretrained(
185
+ 'mosaicml/mpt-30b-chat',
186
+ trust_remote_code=True
187
+ )
188
+ ```
189
+ Note: This model requires that `trust_remote_code=True` be passed to the `from_pretrained` method.
190
+ This is because we use a custom `MPT` model architecture that is not yet part of the Hugging Face `transformers` package.
191
+ `MPT` includes options for many training efficiency features such as [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf), [ALiBi](https://arxiv.org/abs/2108.12409), [QK LayerNorm](https://arxiv.org/abs/2010.04245), and more.
192
+
193
+ To use the optimized [triton implementation](https://github.com/openai/triton) of FlashAttention, you can load the model on GPU (`cuda:0`) with `attn_impl='triton'` and with `bfloat16` precision:
194
+ ```python
195
+ import torch
196
+ import transformers
197
+
198
+ name = 'mosaicml/mpt-30b-chat'
199
+
200
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
201
+ config.attn_config['attn_impl'] = 'triton' # change this to use triton-based FlashAttention
202
+ config.init_device = 'cuda:0' # For fast initialization directly on GPU!
203
+
204
+ model = transformers.AutoModelForCausalLM.from_pretrained(
205
+ name,
206
+ config=config,
207
+ torch_dtype=torch.bfloat16, # Load model weights in bfloat16
208
+ trust_remote_code=True
209
+ )
210
+ ```
211
+
212
+ The model was trained initially with a sequence length of 4096 with an additional pretraining stage for sequence length adapation up to 8192. However, ALiBi enables users to increase the maximum sequence length even further during finetuning and/or inference. For example:
213
+
214
+ ```python
215
+ import transformers
216
+
217
+ name = 'mosaicml/mpt-30b-chat'
218
+
219
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
220
+ config.max_seq_len = 16384 # (input + output) tokens can now be up to 16384
221
+
222
+ model = transformers.AutoModelForCausalLM.from_pretrained(
223
+ name,
224
+ config=config,
225
+ trust_remote_code=True
226
+ )
227
+ ```
228
+
229
+ This model was trained with the MPT-30B tokenizer which is based on the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer and includes additional padding and eos tokens.
230
+
231
+ ```python
232
+ from transformers import AutoTokenizer
233
+ tokenizer = AutoTokenizer.from_pretrained('mosaicml/mpt-30b')
234
+ ```
235
+
236
+ The model can then be used, for example, within a text-generation pipeline.
237
+ Note: when running Torch modules in lower precision, it is best practice to use the [torch.autocast context manager](https://pytorch.org/docs/stable/amp.html).
238
+
239
+ ```python
240
+ from transformers import pipeline
241
+
242
+ with torch.autocast('cuda', dtype=torch.bfloat16):
243
+ inputs = tokenizer('Here is a recipe for vegan banana bread:\n', return_tensors="pt").to('cuda')
244
+ outputs = model.generate(**inputs, max_new_tokens=100)
245
+ print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
246
+
247
+ # or using the HF pipeline
248
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
249
+ with torch.autocast('cuda', dtype=torch.bfloat16):
250
+ print(
251
+ pipe('Here is a recipe for vegan banana bread:\n',
252
+ max_new_tokens=100,
253
+ do_sample=True,
254
+ use_cache=True))
255
+ ```
256
+
257
+ ## Model Description
258
+
259
+ The architecture is a modification of a standard decoder-only transformer.
260
+
261
+ The model has been modified from a standard transformer in the following ways:
262
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
263
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
264
+ * It does not use biases
265
+
266
+
267
+ | Hyperparameter | Value |
268
+ |----------------|-------|
269
+ |n_parameters | 29.95B |
270
+ |n_layers | 48 |
271
+ | n_heads | 64 |
272
+ | d_model | 7168 |
273
+ | vocab size | 50432 |
274
+ | sequence length | 8192 |
275
+
276
+ ## Data Mix
277
+
278
+ The model was trained on the following data mix:
279
+
280
+ | Data Source | Number of Tokens in Source | Proportion |
281
+ |-------------|----------------------------|------------|
282
+ | Airoboros/GPT4 | 26.4M | 1.71% |
283
+ | Baize | 55.0M | 3.57% |
284
+ | Camel | 301M | 19.54% |
285
+ | GPTeacher | 7.56M | 0.49% |
286
+ | Guanaco | 15.6M | 1.02% |
287
+ | LongCoversations | 18.4M | 1.19% |
288
+ | ShareGPT | 821M | 53.24% |
289
+ | WizardLM | 297M | 19.23% |
290
+
291
+ "LongConversations" is a GPT3.5/4-generated dataset, details of which will be released at a later date.
292
+
293
+ ### Training Configuration
294
+
295
+ This model was trained on 64 H100s for about 7.6 hours using the [MosaicML Platform](https://www.mosaicml.com/platform).
296
+ The model was trained with sharded data parallelism using [FSDP](https://pytorch.org/docs/stable/fsdp.html) and used the AdamW optimizer.
297
+
298
+ ## Limitations and Biases
299
+
300
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
301
+
302
+ MPT-30B-Chat can produce factually incorrect output, and should not be relied on to produce factually accurate information.
303
+ MPT-30B-Chat was trained on various public datasets.
304
+ While great efforts have been taken to clean the pretraining data, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
305
+
306
+ ## Acknowledgements
307
+
308
+ This model was finetuned by Sam Havens and the MosaicML NLP team
309
+
310
+ ## Disclaimer
311
+
312
+ The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
313
+
314
+
315
+ ## MosaicML Platform
316
+
317
+ If you're interested in [training](https://www.mosaicml.com/training) and [deploying](https://www.mosaicml.com/inference) your own MPT or LLMs on the MosaicML Platform, [sign up here](https://forms.mosaicml.com/demo?utm_source=huggingface&utm_medium=referral&utm_campaign=mpt-7b).
318
+
319
+
320
+ ## Citation
321
+
322
+ Please cite this model using the following format:
323
+
324
+ ```
325
+ @online{MosaicML2023Introducing,
326
+ author = {MosaicML NLP Team},
327
+ title = {Introducing MPT-30B: Raising the bar
328
+ for open-source foundation models},
329
+ year = {2023},
330
+ url = {www.mosaicml.com/blog/mpt-30b},
331
+ note = {Accessed: 2023-06-22},
332
+ urldate = {2023-06-22}
333
+ }
334
+ ```