blackmount8 commited on
Commit
a483f90
·
1 Parent(s): e29d4fb

Update model and tokenizer.

Browse files
README.md CHANGED
@@ -1,3 +1,241 @@
1
  ---
 
2
  license: cc-by-sa-3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ inference: false
3
  license: cc-by-sa-3.0
4
+ datasets:
5
+ - competition_math
6
+ - conceptofmind/cot_submix_original/cot_gsm8k
7
+ - knkarthick/dialogsum
8
+ - mosaicml/dolly_hhrlhf
9
+ - duorc
10
+ - tau/scrolls/qasper
11
+ - emozilla/quality
12
+ - scrolls/summ_screen_fd
13
+ - spider
14
+ tags:
15
+ - Composer
16
+ - MosaicML
17
+ - llm-foundry
18
+ inference: false
19
  ---
20
+ # blackmount8/mpt-30b-instruct-ct2-int8_float16
21
+
22
+ Int8_float16 version of [mosaicml/mpt-30b-instruct](https://huggingface.co/mosaicml/mpt-30b-instruct), quantized using CTranslate2.
23
+
24
+ ## MPT-30B-Instruct
25
+
26
+ MPT-30B-Instruct is a model for short-form instruction following.
27
+ It is built by finetuning [MPT-30B](https://huggingface.co/mosaicml/mpt-30b) on [Dolly HHRLHF](https://huggingface.co/datasets/mosaicml/dolly_hhrlhf) 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. It is also trained on [Competition Math](https://huggingface.co/datasets/competition_math), [Duorc](https://huggingface.co/datasets/duorc), [CoT GSM8k](https://huggingface.co/datasets/conceptofmind/cot_submix_original), [Qasper](https://huggingface.co/datasets/allenai/qasper), [Quality](https://huggingface.co/datasets/emozilla/quality), [Summ Screen FD](https://huggingface.co/datasets/tau/scrolls) and [Spider](https://huggingface.co/datasets/spider).
28
+
29
+ * License: _CC-By-SA-3.0_
30
+
31
+ This model was trained by [MosaicML](https://www.mosaicml.com) and follows a modified decoder-only transformer architecture.
32
+
33
+ ## Model Date
34
+
35
+ June 22, 2023
36
+
37
+ ## Model License
38
+
39
+ CC-By-SA-3.0
40
+
41
+ ## Documentation
42
+
43
+ * [Blog post: Raising the bar for open-source foundation models](https://www.mosaicml.com/blog/mpt-30b)
44
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
45
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://mosaicml.me/slack)!
46
+
47
+ ### Example Question/Instruction
48
+
49
+ **Bespokenizer46**
50
+
51
+ > I need to convince my friend, Phyllis, that she should train a custom LLM for her Fortune 500 company using the MosaicML Platform.
52
+ > Please write an email that explains why MosaicML's emphasis on cutting edge methodology, data privacy, and efficiency are so important.
53
+ > End the email with a friendly inquiry about Phyllis's family.
54
+
55
+ **MPT-30B-Instruct**:
56
+
57
+ > Phyllis -
58
+ > I know you're always looking for ways to improve efficiency at work and I think I've found a solution that you'll be very interested in.
59
+ > LLMs are only as good as the data they're trained on and the training process can be very time consuming and resource intensive. MosaicML uses cutting edge methodology to efficiently train high quality models without compromising data privacy.
60
+ > They also provide tools to easily connect to and use the model in your daily workflow.
61
+ > I think you'd really enjoy speaking with their founder, we can set up a call if you're interested.
62
+ > Also, I know it's been a tough year for your family, how are things?
63
+
64
+ > Best,
65
+ > Your Friend
66
+
67
+ ## How to Use
68
+
69
+ 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.
70
+
71
+ 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.
72
+
73
+ ```python
74
+ import transformers
75
+ model = transformers.AutoModelForCausalLM.from_pretrained(
76
+ 'mosaicml/mpt-30b-instruct',
77
+ trust_remote_code=True
78
+ )
79
+ ```
80
+
81
+ 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:
82
+
83
+ ```python
84
+ import torch
85
+ import transformers
86
+
87
+ name = 'mosaicml/mpt-30b-instruct'
88
+
89
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
90
+ config.attn_config['attn_impl'] = 'triton' # change this to use triton-based FlashAttention
91
+ config.init_device = 'cuda:0' # For fast initialization directly on GPU!
92
+
93
+ model = transformers.AutoModelForCausalLM.from_pretrained(
94
+ name,
95
+ config=config,
96
+ torch_dtype=torch.bfloat16, # Load model weights in bfloat16
97
+ trust_remote_code=True
98
+ )
99
+ ```
100
+
101
+ The model was trained initially on a sequence length of 2048. An additional pre-training phase was included for sequence length adaptation to 8192. However, ALiBi further enables users to increase the maximum sequence length during finetuning and/or inference. For example:
102
+
103
+ ```python
104
+ import transformers
105
+
106
+ name = 'mosaicml/mpt-30b-instruct'
107
+
108
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
109
+ config.max_seq_len = 16384 # (input + output) tokens can now be up to 16384
110
+
111
+ model = transformers.AutoModelForCausalLM.from_pretrained(
112
+ name,
113
+ config=config,
114
+ trust_remote_code=True
115
+ )
116
+ ```
117
+
118
+ 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.
119
+
120
+ ```python
121
+ from transformers import AutoTokenizer
122
+ tokenizer = AutoTokenizer.from_pretrained('mosaicml/mpt-30b')
123
+ ```
124
+
125
+ The model can then be used, for example, within a text-generation pipeline.
126
+ 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).
127
+
128
+ ```python
129
+ from transformers import pipeline
130
+
131
+ with torch.autocast('cuda', dtype=torch.bfloat16):
132
+ inputs = tokenizer('Here is a recipe for vegan banana bread:\n', return_tensors="pt").to('cuda')
133
+ outputs = model.generate(**inputs, max_new_tokens=100)
134
+ print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
135
+
136
+ # or using the HF pipeline
137
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
138
+ with torch.autocast('cuda', dtype=torch.bfloat16):
139
+ print(
140
+ pipe('Here is a recipe for vegan banana bread:\n',
141
+ max_new_tokens=100,
142
+ do_sample=True,
143
+ use_cache=True))
144
+ ```
145
+
146
+ ### Formatting
147
+
148
+ This model was trained on data formatted as follows:
149
+
150
+ ```python
151
+ def format_prompt(instruction):
152
+ template = "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n###Instruction\n{instruction}\n\n### Response\n"
153
+ return template.format(instruction=instruction)
154
+
155
+ example = "Tell me a funny joke.\nDon't make it too funny though."
156
+ fmt_ex = format_prompt(instruction=example)
157
+ ```
158
+
159
+ In the above example, `fmt_ex` is ready to be tokenized and sent through the model.
160
+
161
+ ## Model Description
162
+
163
+ The architecture is a modification of a standard decoder-only transformer.
164
+
165
+ The model has been modified from a standard transformer in the following ways:
166
+
167
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
168
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
169
+ * It does not use biases
170
+
171
+ | Hyperparameter | Value |
172
+ | --------------- | ------ |
173
+ | n_parameters | 29.95B |
174
+ | n_layers | 48 |
175
+ | n_heads | 64 |
176
+ | d_model | 7168 |
177
+ | vocab size | 50432 |
178
+ | sequence length | 8192 |
179
+
180
+ ## Data Mix
181
+
182
+ The model was trained on the following data mix:
183
+
184
+ | Data Source | Number of Tokens in Source | Proportion |
185
+ | ---------------------- | -------------------------- | ---------- |
186
+ | competition_math | 1.6 M | 3.01% |
187
+ | cot_gsm8k | 3.36 M | 6.32% |
188
+ | dialogsum | 0.1 M | 0.19% |
189
+ | dolly_hhrlhf | 5.89 M | 11.07% |
190
+ | duorc | 8.2 M | 15.51% |
191
+ | qasper | 10.97 M | 20.63% |
192
+ | quality | 11.31 M | 21.28% |
193
+ | scrolls/summ_screen_fd | 11.56 M | 21.82% |
194
+ | spider | 0.089 M | 0.16% |
195
+
196
+ ## PreTraining Data
197
+
198
+ For more details on the pretraining process, see [MPT-30B](https://huggingface.co/mosaicml/mpt-30b).
199
+
200
+ The data was tokenized using the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
201
+
202
+ ### Training Configuration
203
+
204
+ This model was trained on 72 A100 40GB GPUs for 8 hours using the [MosaicML Platform](https://www.mosaicml.com/platform).
205
+ The model was trained with sharded data parallelism using [FSDP](https://pytorch.org/docs/stable/fsdp.html) and used the AdamW optimizer.
206
+
207
+ ## Limitations and Biases
208
+
209
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
210
+
211
+ MPT-30B-Instruct can produce factually incorrect output, and should not be relied on to produce factually accurate information.
212
+ MPT-30B-Instruct was trained on various public datasets.
213
+ 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.
214
+
215
+ ## Acknowledgements
216
+
217
+ This model was finetuned by Sam Havens, Alex Trott, and the MosaicML NLP team
218
+
219
+ ## MosaicML Platform
220
+
221
+ 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-30b).
222
+
223
+ ## Disclaimer
224
+
225
+ 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.
226
+
227
+ ## Citation
228
+
229
+ Please cite this model using the following format:
230
+
231
+ ```
232
+ @online{MosaicML2023Introducing,
233
+ author = {MosaicML NLP Team},
234
+ title = {Introducing MPT-30B: Raising the bar
235
+ for open-source foundation models},
236
+ year = {2023},
237
+ url = {www.mosaicml.com/blog/mpt-30b},
238
+ note = {Accessed: 2023-06-22},
239
+ urldate = {2023-06-22}
240
+ }
241
+ ```
config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "layer_norm_epsilon": null,
5
+ "unk_token": "<|endoftext|>"
6
+ }
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:992a79c800728d5c6dc891e56e34ce7357b97d84b365fc8b4372d4fb5024c169
3
+ size 29970535088
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "pad_token": "<|endoftext|>",
5
+ "unk_token": "<|endoftext|>"
6
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": "<|endoftext|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "eos_token": "<|endoftext|>",
6
+ "model_max_length": 8192,
7
+ "tokenizer_class": "GPTNeoXTokenizer",
8
+ "unk_token": "<|endoftext|>"
9
+ }
vocabulary.json ADDED
The diff for this file is too large to render. See raw diff