Transformers
mpt
Composer
MosaicML
llm-foundry
TheBloke commited on
Commit
9d98488
·
1 Parent(s): ee049fb

First GGML model commit.

Browse files
Files changed (1) hide show
  1. README.md +238 -0
README.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - Composer
5
+ - MosaicML
6
+ - llm-foundry
7
+ datasets:
8
+ - the_pile_books3
9
+ inference: false
10
+ ---
11
+
12
+
13
+ # MPT-7B-Storywriter GGML
14
+
15
+ This is GGML format quantised 4-bit, 5-bit and 8-bit [MosaicML's MPT-7B-Storywriter](https://huggingface.co/mosaicml/mpt-7b-storywriter).
16
+
17
+ This repo is the result of converting to GGML and quantising.
18
+
19
+ ## Repositories available
20
+
21
+ * [MPT-7B: 4-bit, 5-bit and 8-bit GGML models for CPU (+CUDA) inference](https://huggingface.co/TheBloke/MPT-7B-GGML).
22
+ * [MPT-7B-Instruct: 4-bit, 5-bit and 8-bit GGML models for CPU (+CUDA) inference](https://huggingface.co/TheBloke/MPT-7B-Instruct-GGML).
23
+ * [MPT-7B-Storywriter: 4-bit, 5-bit and 8-bit GGML models for CPU (+CUDA) inference](https://huggingface.co/TheBloke/MPT-7B-Storywriter-GGML).
24
+
25
+ ## Provided files
26
+ | Name | Quant method | Bits | Size | RAM required | Use case |
27
+ | ---- | ---- | ---- | ---- | ---- | ----- |
28
+ `mpt-7b-storywriter.ggmlv2.q4_0.bin` | q4_0 | 4bit | 4.21GB | 7.0GB | 4-bit. |
29
+ `mpt-7b-storywriter.ggmlv2.q4_1.bin` | q4_0 | 4bit | 4.63GB | 7.5GB | 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
30
+ `mpt-7b-storywriter.ggmlv2.q5_0.bin` | q5_0 | 5bit | 4.63GB | 7.5GB | 5-bit. Higher accuracy, higher resource usage and slower inference. |
31
+ `mpt-7b-storywriter.ggmlv2.q5_1.bin` | q5_1 | 5bit | 5.06GB | 7.5GB | 5-bit. Even higher accuracy, and higher resource usage and slower inference. |
32
+ `mpt-7b-storywriter.ggmlv2.q8_0.bin` | q8_0 | 8bit | 7.58GB | 9.0GB | 8-bit. Almost indistinguishable from float16. Huge resource use and slow. Not recommended for normal use. |
33
+ `mpt-7b-storywriter.ggmlv2.fp16.bin` | fp16 | 16bit | GB | GB | Full 16-bit. |
34
+
35
+ ## Compatibilty
36
+
37
+ These files are **not** compatible with llama.cpp.
38
+
39
+ Currently they can be used with:
40
+ * The example `mpt` binary provided with [ggml](https://github.com/ggerganov/ggml)
41
+ * [rustformers' llm](https://github.com/rustformers/llm)
42
+
43
+ As other options become available I will endeavour to update them here (do let me know in the Community tab if I've missed something!)
44
+
45
+ ## How to build, and an example of using the ggml `mpt` binary (command line only):
46
+
47
+ ```
48
+ git clone https://github.com/ggerganov/ggml
49
+ cd ggml
50
+ mkdir build
51
+ cd build
52
+ cmake ..
53
+ cmake --build . --config Release
54
+ bin/mpt -m /path/to/mpt-7b-storywriter.ggmlv2.q4_0.bin -t 8 -n 512 -p "Write a story about llamas"
55
+ ```
56
+
57
+ Please see the ggml repo for other build options.
58
+
59
+ # Original model card: MPT-7B-Storywriter
60
+
61
+ # MPT-7B-StoryWriter-65k+
62
+
63
+ MPT-7B-StoryWriter-65k+ is a model designed to read and write fictional stories with super long context lengths.
64
+ It was 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).
65
+ At inference time, thanks to [ALiBi](https://arxiv.org/abs/2108.12409), MPT-7B-StoryWriter-65k+ can extrapolate even beyond 65k tokens.
66
+ We demonstrate generations as long as 84k tokens on a single node of 8 A100-80GB GPUs in our [blogpost](https://www.mosaicml.com/blog/mpt-7b).
67
+ * License: Apache 2.0
68
+ * [Demo on Hugging Face Spaces](https://huggingface.co/spaces/mosaicml/mpt-7b-storywriter)
69
+
70
+ This model was trained by [MosaicML](https://www.mosaicml.com) and follows a modified decoder-only transformer architecture.
71
+
72
+ ## Model Date
73
+
74
+ May 5, 2023
75
+
76
+ ## Model License
77
+
78
+ Apache 2.0
79
+
80
+ ## Documentation
81
+
82
+ * [Blog post: Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs](https://www.mosaicml.com/blog/mpt-7b)
83
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
84
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://join.slack.com/t/mosaicml-community/shared_invite/zt-1btms90mc-GipE2ufuPkKY0QBrmF3LSA)!
85
+
86
+
87
+ ## How to Use
88
+
89
+ Note: This model requires that `trust_remote_code=True` be passed to the `from_pretrained` method. This is because we use a custom model architecture that is not yet part of the `transformers` package.
90
+
91
+ It includes options for many training efficiency features such as [FlashAttention (Dao et al. 2022)](https://arxiv.org/pdf/2205.14135.pdf), [ALiBi](https://arxiv.org/abs/2108.12409), QK LayerNorm, and more.
92
+
93
+ ```python
94
+ import transformers
95
+ model = transformers.AutoModelForCausalLM.from_pretrained(
96
+ 'mosaicml/mpt-7b-storywriter',
97
+ trust_remote_code=True
98
+ )
99
+ ```
100
+
101
+ To use the optimized [triton implementation](https://github.com/openai/triton) of FlashAttention, you can load the model with `attn_impl='triton'` and move the model to `bfloat16`:
102
+ ```python
103
+ config = transformers.AutoConfig.from_pretrained(
104
+ 'mosaicml/mpt-7b-storywriter',
105
+ trust_remote_code=True
106
+ )
107
+ config.attn_config['attn_impl'] = 'triton'
108
+
109
+ model = transformers.AutoModelForCausalLM.from_pretrained(
110
+ 'mosaicml/mpt-7b-storywriter',
111
+ config=config,
112
+ torch_dtype=torch.bfloat16,
113
+ trust_remote_code=True
114
+ )
115
+ model.to(device='cuda:0')
116
+ ```
117
+
118
+ Although the model was trained with a sequence length of 2048 and finetuned with a sequence length of 65536,
119
+ ALiBi enables users to increase the maximum sequence length during finetuning and/or inference. For example:
120
+
121
+ ```python
122
+ config = transformers.AutoConfig.from_pretrained(
123
+ 'mosaicml/mpt-7b-storywriter',
124
+ trust_remote_code=True
125
+ )
126
+ config.update({"max_seq_len": 83968})
127
+ model = transformers.AutoModelForCausalLM.from_pretrained(
128
+ 'mosaicml/mpt-7b-storywriter',
129
+ config=config,
130
+ trust_remote_code=True
131
+ )
132
+ ```
133
+
134
+ This model was trained with the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
135
+
136
+ ```python
137
+ from transformers import AutoTokenizer
138
+ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
139
+ ```
140
+
141
+ ## Example Epilogue
142
+
143
+ The full text of the _The Great Gatsby_ (67873 tokens) was fed to the model, followed by the text "EPILOGUE"
144
+
145
+ **TheRealFitzgerald233**:
146
+
147
+ > ...
148
+ >
149
+ > So we beat on, boats against the current, borne back ceaselessly into the past
150
+ >
151
+ > EPILOGUE
152
+
153
+ **MPT-7B-StoryWriter**:
154
+
155
+ >I have lived so long in the shadow of this dream that I may never see the bright sunlight of reality. I may look up some morning and find that I am six feet under, and that Gatsby, who gave me the dream and everything else, will have vanished behind me.
156
+ >
157
+ >And so it was. I had hardly crossed the threshold of the old world when my eye caught the headlines of a newspaper, and I knew at once that my dream was over. I knew that Gatsby was dead.
158
+ >
159
+ >And I knew that day that I didn't love her.
160
+ >
161
+ >That night I took the last train for West Egg, and when I reached home I went directly to my attic and brought down all Gatsby's letters.
162
+ >
163
+ >I have sorted them by date and placed them in the order in which they were written. They are very few in number.
164
+ >
165
+ >They are dated between April of nineteen eighteen and January of nineteen nineteen, and the last one I have here is the one that told me he was dead.
166
+ >
167
+ >There is something in that last letter that frightens me. It is the sense of a finality, of a completeness. I never heard of him after that, and I was glad.
168
+ >
169
+ >But a few months ago I read somewhere that he had been seen in New York. He had become a great man.
170
+ >
171
+ >And I knew that he had not changed at all.
172
+
173
+ ## Model Description
174
+
175
+ The architecture is a modification of a standard decoder-only transformer.
176
+
177
+ The model has been modified from a standard transformer in the following ways:
178
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
179
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
180
+ * It does not use biases
181
+
182
+
183
+ | Hyperparameter | Value |
184
+ |----------------|-------|
185
+ |n_parameters | 6.7B |
186
+ |n_layers | 32 |
187
+ | n_heads | 32 |
188
+ | d_model | 4096 |
189
+ | vocab size | 50432 |
190
+ | sequence length | **65536** |
191
+
192
+ ## PreTraining Data
193
+
194
+ For more details on the pretraining process, see [MPT-7B](https://huggingface.co/mosaicml/mpt-7b).
195
+
196
+ The data was tokenized using the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
197
+
198
+ ### Training Configuration
199
+
200
+ This model was trained on 8 A100-80GBs for about 2 days using the [MosaicML Platform](https://www.mosaicml.com/platform).
201
+ 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.
202
+
203
+ ## Limitations and Biases
204
+
205
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
206
+
207
+ MPT-7B-StoryWriter can produce factually incorrect output, and should not be relied on to produce factually accurate information.
208
+ MPT-7B-StoryWriter was trained on various public datasets.
209
+ 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.
210
+
211
+
212
+ ## Acknowledgements
213
+
214
+ This model was finetuned by Alex Trott and the MosaicML NLP team
215
+
216
+ ## MosaicML Platform
217
+
218
+ 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).
219
+
220
+ ## Disclaimer
221
+
222
+ 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.
223
+
224
+
225
+ ## Citation
226
+
227
+ Please cite this model using the following format:
228
+
229
+ ```
230
+ @online{MosaicML2023Introducing,
231
+ author = {MosaicML NLP Team},
232
+ title = {Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs},
233
+ year = {2023},
234
+ url = {www.mosaicml.com/blog/mpt-7b},
235
+ note = {Accessed: 2023-03-28}, % change this date
236
+ urldate = {2023-03-28} % change this date
237
+ }
238
+ ```