maddes8cht commited on
Commit
7439c1d
1 Parent(s): 3280ced

"Update README.md"

Browse files
Files changed (1) hide show
  1. README.md +316 -0
README.md ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 - GGUF
21
+ - Model creator: [mosaicml](https://huggingface.co/mosaicml)
22
+ - Original model: [mpt-7b](https://huggingface.co/mosaicml/mpt-7b)
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
71
+
72
+ MPT-7B is a decoder-style transformer pretrained from scratch on 1T tokens of English text and code.
73
+ This model was trained by [MosaicML](https://www.mosaicml.com).
74
+
75
+ MPT-7B is part of the family of MosaicPretrainedTransformer (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 is
87
+
88
+ * **Licensed for the possibility of commercial use** (unlike [LLaMA](https://arxiv.org/abs/2302.13971)).
89
+ * **Trained on a large amount of data** (1T tokens like [LLaMA](https://arxiv.org/abs/2302.13971) vs. 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 extremely long inputs** thanks to [ALiBi](https://arxiv.org/abs/2108.12409) (we finetuned [MPT-7B-StoryWriter-65k+](https://huggingface.co/mosaicml/mpt-7b-storywriter) on up to 65k inputs and can handle up to 84k vs. 2k-4k for other open source models).
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:
95
+
96
+ The following models are finetuned on MPT-7B:
97
+
98
+ * [MPT-7B-StoryWriter-65k+](https://huggingface.co/mosaicml/mpt-7b-storywriter): a model designed to read and write fictional stories with super long context lengths.
99
+ Built by finetuning MPT-7B with a context length of 65k tokens on a filtered fiction subset of the [books3 dataset](https://huggingface.co/datasets/the_pile_books3).
100
+ At inference time, thanks to [ALiBi](https://arxiv.org/abs/2108.12409), MPT-7B-StoryWriter-65k+ can extrapolate even beyond 65k tokens.
101
+ We demonstrate generations as long as 80k tokens on a single A100-80GB GPU in our [blogpost](www.mosaicml.com/blog/mpt-7b).
102
+ * License: Apache 2.0
103
+
104
+ * [MPT-7B-Instruct](https://huggingface.co/mosaicml/mpt-7b-instruct): a model for short-form instruction following.
105
+ Built by finetuning MPT-7B on a [dataset](https://huggingface.co/datasets/mosaicml/dolly_hhrlhf) we also release, derived from the [Databricks Dolly-15k](https://huggingface.co/datasets/databricks/databricks-dolly-15k) and the [Anthropic Helpful and Harmless (HH-RLHF)](https://huggingface.co/datasets/Anthropic/hh-rlhf) datasets.
106
+ * License: _CC-By-SA-3.0_
107
+
108
+ * [MPT-7B-Chat](https://huggingface.co/mosaicml/mpt-7b-chat): a chatbot-like model for dialogue generation.
109
+ Built by finetuning MPT-7B on the [ShareGPT-Vicuna](https://huggingface.co/datasets/jeffwan/sharegpt_vicuna), [HC3](https://huggingface.co/datasets/Hello-SimpleAI/HC3),
110
+ [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca), [HH-RLHF](https://huggingface.co/datasets/Anthropic/hh-rlhf), and [Evol-Instruct](https://huggingface.co/datasets/victor123/evol_instruct_70k) datasets.
111
+ * License: _CC-By-NC-SA-4.0_
112
+
113
+ ## Model Date
114
+
115
+ May 5, 2023
116
+
117
+ ## Model License
118
+
119
+ Apache-2.0
120
+
121
+ ## Documentation
122
+
123
+ * [Blog post: Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs](https://www.mosaicml.com/blog/mpt-7b)
124
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
125
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://mosaicml.me/slack)!
126
+
127
+
128
+ ## How to Use
129
+
130
+ This model is best used with the MosaicML [llm-foundry repository](https://github.com/mosaicml/llm-foundry) for training and finetuning.
131
+
132
+ ```python
133
+ import transformers
134
+ model = transformers.AutoModelForCausalLM.from_pretrained(
135
+ 'mosaicml/mpt-7b',
136
+ trust_remote_code=True
137
+ )
138
+ ```
139
+ Note: This model requires that `trust_remote_code=True` be passed to the `from_pretrained` method.
140
+ This is because we use a custom `MPT` model architecture that is not yet part of the Hugging Face `transformers` package.
141
+ `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.
142
+
143
+ 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:
144
+ ```python
145
+ import torch
146
+ import transformers
147
+
148
+ name = 'mosaicml/mpt-7b'
149
+
150
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
151
+ config.attn_config['attn_impl'] = 'triton'
152
+ config.init_device = 'cuda:0' # For fast initialization directly on GPU!
153
+
154
+ model = transformers.AutoModelForCausalLM.from_pretrained(
155
+ name,
156
+ config=config,
157
+ torch_dtype=torch.bfloat16, # Load model weights in bfloat16
158
+ trust_remote_code=True
159
+ )
160
+ ```
161
+
162
+ 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:
163
+
164
+ ```python
165
+ import transformers
166
+
167
+ name = 'mosaicml/mpt-7b'
168
+
169
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
170
+ config.max_seq_len = 4096 # (input + output) tokens can now be up to 4096
171
+
172
+ model = transformers.AutoModelForCausalLM.from_pretrained(
173
+ name,
174
+ config=config,
175
+ trust_remote_code=True
176
+ )
177
+ ```
178
+
179
+ This model was trained with the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
180
+
181
+ ```python
182
+ from transformers import AutoTokenizer
183
+ tokenizer = AutoTokenizer.from_pretrained('EleutherAI/gpt-neox-20b')
184
+ ```
185
+
186
+ The model can then be used, for example, within a text-generation pipeline.
187
+ 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).
188
+
189
+ ```python
190
+ from transformers import pipeline
191
+
192
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
193
+
194
+ with torch.autocast('cuda', dtype=torch.bfloat16):
195
+ print(
196
+ pipe('Here is a recipe for vegan banana bread:\n',
197
+ max_new_tokens=100,
198
+ do_sample=True,
199
+ use_cache=True))
200
+ ```
201
+
202
+ ## Model Description
203
+
204
+ The architecture is a modification of a standard decoder-only transformer.
205
+
206
+ The model has been modified from a standard transformer in the following ways:
207
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
208
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
209
+ * It does not use biases
210
+
211
+
212
+ | Hyperparameter | Value |
213
+ |----------------|-------|
214
+ |n_parameters | 6.7B |
215
+ |n_layers | 32 |
216
+ | n_heads | 32 |
217
+ | d_model | 4096 |
218
+ | vocab size | 50432 |
219
+ | sequence length | 2048 |
220
+
221
+
222
+
223
+ ## Training Data
224
+
225
+ ### Streaming Datasets
226
+
227
+ 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.
228
+ StreamingDataset obviates the need to download the whole dataset before starting training, and allows instant resumption of training from any point in the dataset.
229
+
230
+
231
+ ### Data Mix
232
+
233
+ The model was trained for 1T tokens (with batch size 1760 and sequence length 2048). It was trained on the following data mix:
234
+
235
+
236
+ | Data Source | Number of Tokens in Source | Proportion | Effective Number of Tokens | Epochs |
237
+ |-------------|----------------------------|------------|----------------------------|--------|
238
+ | mC4 3.1.0 - English | 417.99 B | 0.33 | 330 B | 0.14 |
239
+ | C4 - English - SemDedup 80% | 100.42 B | 0.299 | 299 B | 2.98 |
240
+ | RedPajama - CommonCrawl | 878.45 B | 0.1 | 100 B | 0.11 |
241
+ | The Stack - Selected Languages | 463.78 B | 0.1 | 100 B | 0.22 |
242
+ | RedPajama - Wikipedia - En | 4.87 B | 0.04 | 40 B | 8.21 |
243
+ | The Stack - Markdown | 107.07 B | 0.035 | 35 B | 0.33 |
244
+ | S2ORC | 48.85 B | 0.033 | 33 B | 0.68 |
245
+ | RedPajama - Books | 26.02 B | 0.03 | 30B | 1.15 |
246
+ | RedPajama - arXiv | 28.10 B | 0.019 | 19 B | 0.68 |
247
+ | RedPajama - StackExchange | 20.54 B | 0.014 | 14 B |0.68 |
248
+
249
+ Samples for each batch were selected from one of the datasets with the probability specified above.
250
+ 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.
251
+
252
+ 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,
253
+ most of which are relevant for tokenizing code:
254
+ (1) It was trained on a diverse mix of data that includes code (The Pile)
255
+ (2) It applies consistent space delimitation, unlike the GPT2 tokenizer which tokenizes inconsistently depending on the presence of prefix spaces
256
+ (3) It contains tokens for repeated space characters, which allows superior compression of text with large amounts of repeated space characters.
257
+
258
+ 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.
259
+
260
+ ### Training Configuration
261
+
262
+ This model was trained on 440 A100-40GBs for about 9.5 days using the [MosaicML Platform](https://www.mosaicml.com/platform).
263
+ 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.
264
+
265
+ ## Limitations and Biases
266
+
267
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
268
+
269
+ MPT-7B (Base) is **not** intended for deployment without finetuning.
270
+ It should not be used for human-facing interactions without further guardrails and user consent.
271
+
272
+ MPT-7B can produce factually incorrect output, and should not be relied on to produce factually accurate information.
273
+ MPT-7B was trained on various public datasets.
274
+ 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.
275
+
276
+
277
+ ## MosaicML Platform
278
+
279
+ 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).
280
+
281
+ ## Disclaimer
282
+
283
+ 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.
284
+
285
+ ## Citation
286
+
287
+ Please cite this model using the following format:
288
+
289
+ ```
290
+ @online{MosaicML2023Introducing,
291
+ author = {MosaicML NLP Team},
292
+ title = {Introducing MPT-7B: A New Standard for Open-Source,
293
+ Commercially Usable LLMs},
294
+ year = {2023},
295
+ url = {www.mosaicml.com/blog/mpt-7b},
296
+ note = {Accessed: 2023-05-05},
297
+ urldate = {2023-05-05}
298
+ }
299
+ ```
300
+
301
+ ***End of original Model File***
302
+ ---
303
+
304
+
305
+ ## Please consider to support my work
306
+ **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.
307
+
308
+ <center>
309
+
310
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-io-button.png)](https://maddes8cht.github.io)
311
+ [![Stack Exchange](https://stackexchange.com/users/flair/26485911.png)](https://stackexchange.com/users/26485911)
312
+ [![GitHub](https://maddes8cht.github.io/assets/buttons/github-button.png)](https://github.com/maddes8cht)
313
+ [![HuggingFace](https://maddes8cht.github.io/assets/buttons/huggingface-button.png)](https://huggingface.co/maddes8cht)
314
+ [![Twitter](https://maddes8cht.github.io/assets/buttons/twitter-button.png)](https://twitter.com/maddes1966)
315
+
316
+ </center>