maddes8cht commited on
Commit
1e68722
1 Parent(s): 78fc898

"Update README.md"

Browse files
Files changed (1) hide show
  1. README.md +346 -0
README.md ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - Composer
5
+ - MosaicML
6
+ - llm-foundry
7
+ - StreamingDatasets
8
+ datasets:
9
+ - mc4
10
+ - c4
11
+ - togethercomputer/RedPajama-Data-1T
12
+ - bigcode/the-stack
13
+ - allenai/s2orc
14
+ inference: false
15
+ ---
16
+ [![banner](https://maddes8cht.github.io/assets/buttons/Huggingface-banner.jpg)]()
17
+
18
+ I'm constantly enhancing these model descriptions to provide you with the most relevant and comprehensive information
19
+
20
+ # mpt-7b-8k - GGUF
21
+ - Model creator: [mosaicml](https://huggingface.co/mosaicml)
22
+ - Original model: [mpt-7b-8k](https://huggingface.co/mosaicml/mpt-7b-8k)
23
+
24
+ # Important Update for Falcon Models in llama.cpp Versions After October 18, 2023
25
+
26
+ As noted on the [Llama.cpp GitHub repository](https://github.com/ggerganov/llama.cpp#hot-topics), all new Llama.cpp releases after October 18, 2023, will require a re-quantization due to the new BPE tokenizer.
27
+
28
+ **Good news!** I am glad that my re-quantization process for Falcon Models is nearly complete. Download the latest quantized models to ensure compatibility with recent llama.cpp software.
29
+
30
+ **Key Points:**
31
+
32
+ - **Stay Informed:** Keep an eye on software application release schedules using llama.cpp libraries.
33
+ - **Monitor Upload Times:** Re-quantization is *almost* done. Watch for updates on my Hugging Face Model pages.
34
+
35
+ **Important Compatibility Note:** Old software will work with old Falcon models, but expect updated software to exclusively support the new models.
36
+
37
+ This change primarily affects **Falcon** and **Starcoder** models, with other models remaining unaffected.
38
+
39
+
40
+
41
+
42
+ # About GGUF format
43
+
44
+ `gguf` is the current file format used by the [`ggml`](https://github.com/ggerganov/ggml) library.
45
+ A growing list of Software is using it and can therefore use this model.
46
+ The core project making use of the ggml library is the [llama.cpp](https://github.com/ggerganov/llama.cpp) project by Georgi Gerganov
47
+
48
+ # Quantization variants
49
+
50
+ There is a bunch of quantized files available. How to choose the best for you:
51
+
52
+ # Legacy quants
53
+
54
+ Q4_0, Q4_1, Q5_0, Q5_1 and Q8 are `legacy` quantization types.
55
+ Nevertheless, they are fully supported, as there are several circumstances that cause certain model not to be compatible with the modern K-quants.
56
+ Falcon 7B models cannot be quantized to K-quants.
57
+
58
+ # K-quants
59
+
60
+ K-quants are based on the idea that the quantization of certain parts affects the quality in different ways. If you quantize certain parts more and others less, you get a more powerful model with the same file size, or a smaller file size and lower memory load with comparable performance.
61
+ So, if possible, use K-quants.
62
+ With a Q6_K you should find it really hard to find a quality difference to the original model - ask your model two times the same question and you may encounter bigger quality differences.
63
+
64
+
65
+
66
+
67
+ ---
68
+
69
+ # Original Model Card:
70
+ # MPT-7B-8k
71
+
72
+ MPT-7B-8k is a decoder-style transformer pretrained starting from MPT-7B, but updating the sequence length to 8k and training for an additional 500B tokens, resulting in a total of 1.5T tokens of text and code.
73
+ This model was trained by [MosaicML](https://www.mosaicml.com).
74
+
75
+ MPT-7B-8k is part of the family of Mosaic Pretrained Transformer (MPT) models, which use a modified transformer architecture optimized for efficient training and inference.
76
+
77
+ These architectural changes include performance-optimized layer implementations and the elimination of context length limits by replacing
78
+ positional embeddings with Attention with Linear Biases ([ALiBi](https://arxiv.org/abs/2108.12409)).
79
+ Thanks to these modifications, MPT models can be trained with high throughput efficiency and stable convergence.
80
+ MPT models can also be served efficiently with both standard HuggingFace pipelines and NVIDIA's [FasterTransformer](https://github.com/NVIDIA/FasterTransformer).
81
+
82
+ This model uses the MosaicML LLM codebase, which can be found in the [llm-foundry repository](https://github.com/mosaicml/llm-foundry). It was trained by MosaicML’s NLP team on the [MosaicML platform](https://www.mosaicml.com/training) for LLM pretraining, finetuning, and inference.
83
+
84
+ ### How is this model different?
85
+
86
+ MPT-7B-8k is
87
+
88
+ * **Licensed for the possibility of commercial use.**
89
+ * **Trained on a large amount of data** (1.5T tokens like [XGen](https://huggingface.co/Salesforce/xgen-7b-8k-base) vs. 1T for [LLaMA](https://arxiv.org/abs/2302.13971), 1T for [MPT-7B](https://www.mosaicml.com/blog/mpt-7b), 300B for [Pythia](https://github.com/EleutherAI/pythia), 300B for [OpenLLaMA](https://github.com/openlm-research/open_llama), and 800B for [StableLM](https://github.com/Stability-AI/StableLM)).
90
+ * **Prepared to handle long inputs** thanks to [ALiBi](https://arxiv.org/abs/2108.12409). With ALiBi, the model can extrapolate beyond the 8k training sequence length to up to 10k, and with a few million tokens it can be finetuned to extrapolate much further.
91
+ * **Capable of fast training and inference** via [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf) and [FasterTransformer](https://github.com/NVIDIA/FasterTransformer)
92
+ * **Equipped with highly efficient open-source training code** via the [llm-foundry repository](https://github.com/mosaicml/llm-foundry)
93
+
94
+ ### Models finetuned off MPT-7B-8k:
95
+
96
+ The following models are finetuned on MPT-7B-8k:
97
+
98
+ * [MPT-7B-8k-Instruct](https://huggingface.co/mosaicml/mpt-7b-8k-instruct): a model for long-form instruction following (especially summarization and question-answering).
99
+ Built by finetuning MPT-7B-8k on several carefully curated datasets.
100
+ * License: _CC-BY-SA-3.0_
101
+
102
+ * [MPT-7B-8k-Chat](https://huggingface.co/mosaicml/mpt-7b-8k-chat): a chatbot-like model for dialogue generation.
103
+ Built by finetuning MPT-7B-8k on approximately 1.5B tokens of chat data.
104
+ * License: _CC-By-NC-SA-4.0_
105
+
106
+ ## Model Date
107
+
108
+ July 18, 2023
109
+
110
+ ## Model License
111
+
112
+ Apache-2.0
113
+
114
+ ## Documentation
115
+
116
+ * [Blog post: MPT-7B-8k](https://www.mosaicml.com/blog/long-context-mpt-7b-8k)
117
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
118
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://mosaicml.me/slack)!
119
+
120
+
121
+ ## How to Use
122
+
123
+ This model is best used with the MosaicML [llm-foundry repository](https://github.com/mosaicml/llm-foundry) for training and finetuning.
124
+
125
+ ```python
126
+ import transformers
127
+ model = transformers.AutoModelForCausalLM.from_pretrained(
128
+ 'mosaicml/mpt-7b-8k',
129
+ trust_remote_code=True
130
+ )
131
+ ```
132
+ Note: This model requires that `trust_remote_code=True` be passed to the `from_pretrained` method.
133
+ This is because we use a custom `MPT` model architecture that is not yet part of the Hugging Face `transformers` package.
134
+ `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.
135
+
136
+ 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:
137
+ ```python
138
+ import torch
139
+ import transformers
140
+
141
+ name = 'mosaicml/mpt-7b-8k'
142
+
143
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
144
+ config.attn_config['attn_impl'] = 'triton'
145
+ config.init_device = 'cuda:0' # For fast initialization directly on GPU!
146
+
147
+ model = transformers.AutoModelForCausalLM.from_pretrained(
148
+ name,
149
+ config=config,
150
+ torch_dtype=torch.bfloat16, # Load model weights in bfloat16
151
+ trust_remote_code=True
152
+ )
153
+ ```
154
+
155
+ Although the model was trained with a sequence length of 2048, ALiBi enables users to increase the maximum sequence length during finetuning and/or inference. For example:
156
+
157
+ ```python
158
+ import transformers
159
+
160
+ name = 'mosaicml/mpt-7b-8k'
161
+
162
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
163
+ config.max_seq_len = 10000 # (input + output) tokens can now be up to 10000
164
+
165
+ model = transformers.AutoModelForCausalLM.from_pretrained(
166
+ name,
167
+ config=config,
168
+ trust_remote_code=True
169
+ )
170
+ ```
171
+
172
+ This model was trained with the MPT-7B-8k tokenizer which is identical to the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
173
+
174
+ ```python
175
+ from transformers import AutoTokenizer
176
+ tokenizer = AutoTokenizer.from_pretrained('mosaicml/mpt-7b-8k')
177
+ ```
178
+
179
+ The model can then be used, for example, within a text-generation pipeline.
180
+ 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).
181
+
182
+ ```python
183
+ from transformers import pipeline
184
+
185
+ with torch.autocast('cuda', dtype=torch.bfloat16):
186
+ inputs = tokenizer('Here is a recipe for vegan banana bread:\n', return_tensors="pt").to('cuda')
187
+ outputs = model.generate(**inputs, max_new_tokens=100)
188
+ print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
189
+
190
+ # or using the HF pipeline
191
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
192
+ with torch.autocast('cuda', dtype=torch.bfloat16):
193
+ print(
194
+ pipe('Here is a recipe for vegan banana bread:\n',
195
+ max_new_tokens=100,
196
+ do_sample=True,
197
+ use_cache=True))
198
+ ```
199
+
200
+ ## Model Description
201
+
202
+ The architecture is a modification of a standard decoder-only transformer.
203
+
204
+ The model has been modified from a standard transformer in the following ways:
205
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
206
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
207
+ * It does not use biases
208
+
209
+
210
+ | Hyperparameter | Value |
211
+ |----------------|-------|
212
+ |n_parameters | 6.7B |
213
+ |n_layers | 32 |
214
+ | n_heads | 32 |
215
+ | d_model | 4096 |
216
+ | vocab size | 50432 |
217
+ | sequence length | 2048 |
218
+
219
+
220
+
221
+ ## Training Data
222
+
223
+ ### Streaming Datasets
224
+
225
+ Data was formatted using the MosaicML [StreamingDataset](https://github.com/mosaicml/streaming) library to host our data in object storage and efficiently stream it to our compute cluster during training.
226
+ StreamingDataset obviates the need to download the whole dataset before starting training, and allows instant resumption of training from any point in the dataset.
227
+
228
+
229
+ ### Data Mix
230
+
231
+ The model was trained for ___T tokens. First it was trained for 1T tokens (with batch size 1760 and sequence length 2048) on the following data mix:
232
+
233
+ #### Data Mix for Original 1T Tokens Used to Train MPT-7B
234
+
235
+ | Data Source | Number of Tokens in Source | Proportion | Effective Number of Tokens | Epochs |
236
+ |-------------|----------------------------|------------|----------------------------|--------|
237
+ | mC4 3.1.0 - English | 417.99 B | 0.33 | 330 B | 0.14 |
238
+ | C4 - English - SemDedup 80% | 100.42 B | 0.299 | 299 B | 2.98 |
239
+ | RedPajama - CommonCrawl | 878.45 B | 0.1 | 100 B | 0.11 |
240
+ | The Stack - Selected Languages | 463.78 B | 0.1 | 100 B | 0.22 |
241
+ | RedPajama - Wikipedia - En | 4.87 B | 0.04 | 40 B | 8.21 |
242
+ | The Stack - Markdown | 107.07 B | 0.035 | 35 B | 0.33 |
243
+ | S2ORC | 48.85 B | 0.033 | 33 B | 0.68 |
244
+ | RedPajama - Books | 26.02 B | 0.03 | 30B | 1.15 |
245
+ | RedPajama - arXiv | 28.10 B | 0.019 | 19 B | 0.68 |
246
+ | RedPajama - StackExchange | 20.54 B | 0.014 | 14 B |0.68 |
247
+
248
+ #### Data Mix for Additional 500B Tokens Used to Further Train MPT-7B-8k
249
+
250
+ We took 80B tokens from document samples that were longer than 4096 tokens, and 120B tokens with varying document sample lengths that matched the "baseline" length distribution for a total of 200B tokens in a single dataset.
251
+ We then trained MPT-7B for 500B tokens with a maximum sequence length of 8192, resulting in MPT-7B-8k. Since we trained for 500B tokens using 200B tokens, nearly every subset was trained on for exactly 2.5 epochs.
252
+
253
+ | Sequence Length Distribution | Number of Tokens in Source (Billion) | Proportion | Effective Number of Tokens (Billion) | Epochs |
254
+ |---|---|---|---|---|
255
+ | mC4 3.1.0 - English (200+ words) - Baseline | 33.60 | 16.80% | 84.00 | 2.50 |
256
+ | mC4 3.1.0 - English (200+ words) - ≥4096 tokens | 23.04 | 11.52% | 57.60 | 2.50 |
257
+ | c4 - English - SemDedup 80% - Baseline | 30.12 | 15.06% | 75.30 | 2.50 |
258
+ | c4 - English - SemDedup 80% - ≥4096 tokens | 0.92 | 0.46% | 2.30 | 2.50 |
259
+ | RedPajama - CommonCrawl - Baseline | 8.52 | 4.26% | 21.30 | 2.50 |
260
+ | RedPajama - CommonCrawl - ≥4096 tokens | 12.80 | 6.40% | 32.00 | 2.50 |
261
+ | The Stack - Selected Languages - Baseline | 30.00 | 15.00% | 75.00 | 2.50 |
262
+ | The Stack - Selected Languages - ≥4096 tokens | 10.00 | 5.00% | 25.00 | 2.50 |
263
+ | RedPajama - Wikipedia - Baseline | 3.60 | 1.80% | 9.00 | 2.50 |
264
+ | RedPajama - Wikipedia - ≥4096 tokens | 1.04 | 0.52% | 2.60 | 2.50 |
265
+ | The Stack - Markdown - Baseline | 4.50 | 2.25% | 11.25 | 2.50 |
266
+ | The Stack - Markdown - ≥4096 tokens | 8.00 | 4.00% | 20.00 | 2.50 |
267
+ | Semantic Scholar ORC - Baseline | 3.30 | 1.65% | 8.25 | 2.50 |
268
+ | Semantic Scholar ORC - ≥4096 tokens | 8.00 | 4.00% | 20.00 | 2.50 |
269
+ | RedPajama - Books - Baseline | 3.00 | 1.50% | 7.50 | 2.50 |
270
+ | RedPajama - Books - ≥4096 tokens | 8.00 | 4.00% | 20.00 | 2.50 |
271
+ | RedPajama - arXiv - Baseline | 1.92 | 0.96% | 4.80 | 2.50 |
272
+ | RedPajama - arXiv - ≥4096 tokens | 5.40 | 2.70% | 13.50 | 2.50 |
273
+ | RedPajama - StackExchange - Baseline | 1.44 | 0.72% | 3.60 | 2.50 |
274
+ | RedPajama - StackExchange - ≥4096 tokens | 1.52 | 1.40% | 7.00 | 4.60 |
275
+ | N Training Tokens | 200 | 100.00% | | 2.5 epochs * 200B = 500B tokens |
276
+
277
+
278
+
279
+ Samples for each batch were selected from one of the datasets with the probability specified above.
280
+ The examples were shuffled within each dataset, and each example was constructed from as many sequences from that dataset as were necessary to fill the 2048 sequence length.
281
+
282
+ The data was tokenized using the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer. This BPE tokenizer has a number of desirable characteristics,
283
+ most of which are relevant for tokenizing code:
284
+ (1) It was trained on a diverse mix of data that includes code (The Pile)
285
+ (2) It applies consistent space delimitation, unlike the GPT2 tokenizer which tokenizes inconsistently depending on the presence of prefix spaces
286
+ (3) It contains tokens for repeated space characters, which allows superior compression of text with large amounts of repeated space characters.
287
+
288
+ The model vocabulary size of 50432 was set to be a multiple of 128 (as in [MEGATRON-LM](https://arxiv.org/abs/1909.08053)), model flop utilization (MFU) increased by up to four percentage points.
289
+
290
+ ### Training Configuration
291
+
292
+ This model was trained on 440 A100-40GBs for about 9.5 days using the [MosaicML Platform](https://www.mosaicml.com/platform).
293
+ The model was trained with sharded data parallelism using [FSDP](https://pytorch.org/docs/stable/fsdp.html) and used the [LION](https://arxiv.org/abs/2302.06675) optimizer.
294
+
295
+ ## Limitations and Biases
296
+
297
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
298
+
299
+ MPT-7B-8k is **not** intended for deployment without finetuning.
300
+ It should not be used for human-facing interactions without further guardrails and user consent.
301
+
302
+ MPT-7B-8k can produce factually incorrect output, and should not be relied on to produce factually accurate information.
303
+ MPT-7B-8k 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
+
307
+ ## MosaicML Platform
308
+
309
+ 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://www.mosaicml.com/get-started?utm_source=huggingface&utm_medium=referral&utm_campaign=mpt-7b-8k).
310
+
311
+ ## Disclaimer
312
+
313
+ 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 cosult an attorney before using this model for commercial purposes.
314
+
315
+ ## Citation
316
+
317
+ Please cite this model using the following format:
318
+
319
+ ```
320
+ @online{MosaicML2023Introducing,
321
+ author = {MosaicML NLP Team},
322
+ title = {Introducing MPT-7B: A New Standard for Open-Source,
323
+ ly Usable LLMs},
324
+ year = {2023},
325
+ url = {www.mosaicml.com/blog/mpt-7b},
326
+ note = {Accessed: 2023-03-28}, % change this date
327
+ urldate = {2023-03-28} % change this date
328
+ }
329
+ ```
330
+
331
+ ***End of original Model File***
332
+ ---
333
+
334
+
335
+ ## Please consider to support my work
336
+ **Coming Soon:** I'm in the process of launching a sponsorship/crowdfunding campaign for my work. I'm evaluating Kickstarter, Patreon, or the new GitHub Sponsors platform, and I am hoping for some support and contribution to the continued availability of these kind of models. Your support will enable me to provide even more valuable resources and maintain the models you rely on. Your patience and ongoing support are greatly appreciated as I work to make this page an even more valuable resource for the community.
337
+
338
+ <center>
339
+
340
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-io-button.png)](https://maddes8cht.github.io)
341
+ [![Stack Exchange](https://stackexchange.com/users/flair/26485911.png)](https://stackexchange.com/users/26485911)
342
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-button.png)](https://github.com/maddes8cht)
343
+ [![HuggingFace](https://maddes8cht.github.io/assets/buttons/huggingface-button.png)](https://huggingface.co/maddes8cht)
344
+ [![Twitter](https://maddes8cht.github.io/assets/buttons/twitter-button.png)](https://twitter.com/maddes1966)
345
+
346
+ </center>