Transformers
Composer
MosaicML
llm-foundry
blackmount8 commited on
Commit
eaa45f6
1 Parent(s): acba878

Update model and tokenizer.

Browse files
README.md CHANGED
@@ -1,3 +1,232 @@
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
  ---
19
+ # blackmount8/mpt-7b-instruct-ct2-int8_float16
20
+
21
+ Int8_float16 version of [mosaicml/mpt-7b-instruct](https://huggingface.co/mosaicml/mpt-7b-instruct), quantized using CTranslate2.
22
+
23
+ ---
24
+ license: cc-by-sa-3.0
25
+ datasets:
26
+ - mosaicml/dolly_hhrlhf
27
+ tags:
28
+ - Composer
29
+ - MosaicML
30
+ - llm-foundry
31
+ inference: false
32
+ ---
33
+
34
+ ## MPT-7B-Instruct
35
+
36
+ MPT-7B-Instruct is a model for short-form instruction following.
37
+ It is built by finetuning [MPT-7B](https://huggingface.co/mosaicml/mpt-7b) on a [dataset](https://huggingface.co/datasets/sam-mosaic/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.
38
+ * License: _CC-By-SA-3.0_
39
+ * [Demo on Hugging Face Spaces](https://huggingface.co/spaces/mosaicml/mpt-7b-instruct)
40
+
41
+
42
+ This model was trained by [MosaicML](https://www.mosaicml.com) and follows a modified decoder-only transformer architecture.
43
+
44
+ ## Model Date
45
+
46
+ May 5, 2023
47
+
48
+ ## Model License
49
+
50
+ CC-By-SA-3.0
51
+
52
+ ## Documentation
53
+
54
+ * [Blog post: Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs](https://www.mosaicml.com/blog/mpt-7b)
55
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
56
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://mosaicml.me/slack)!
57
+
58
+ ### Example Question/Instruction
59
+
60
+ **Longboi24**:
61
+ > What is a quoll?
62
+
63
+ **MPT-7B-Instruct**:
64
+
65
+ >A Quoll (pronounced “cool”) is one of Australia’s native carnivorous marsupial mammals, which are also known as macropods or wallabies in other parts around Asia and South America
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-7b-instruct',
77
+ trust_remote_code=True
78
+ )
79
+ ```
80
+ Note: This model requires that `trust_remote_code=True` be passed to the `from_pretrained` method.
81
+ This is because we use a custom `MPT` model architecture that is not yet part of the Hugging Face `transformers` package.
82
+ `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.
83
+
84
+ 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:
85
+ ```python
86
+ import torch
87
+ import transformers
88
+
89
+ name = 'mosaicml/mpt-7b-instruct'
90
+
91
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
92
+ config.attn_config['attn_impl'] = 'triton'
93
+ config.init_device = 'cuda:0' # For fast initialization directly on GPU!
94
+
95
+ model = transformers.AutoModelForCausalLM.from_pretrained(
96
+ name,
97
+ config=config,
98
+ torch_dtype=torch.bfloat16, # Load model weights in bfloat16
99
+ trust_remote_code=True
100
+ )
101
+ ```
102
+
103
+ 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:
104
+
105
+ ```python
106
+ import transformers
107
+
108
+ name = 'mosaicml/mpt-7b-instruct'
109
+
110
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
111
+ config.max_seq_len = 4096 # (input + output) tokens can now be up to 4096
112
+
113
+ model = transformers.AutoModelForCausalLM.from_pretrained(
114
+ name,
115
+ config=config,
116
+ trust_remote_code=True
117
+ )
118
+ ```
119
+
120
+ This model was trained with the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
121
+
122
+ ```python
123
+ from transformers import AutoTokenizer
124
+ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
125
+ ```
126
+
127
+ The model can then be used, for example, within a text-generation pipeline.
128
+ 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).
129
+
130
+ ```python
131
+ from transformers import pipeline
132
+
133
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
134
+
135
+ with torch.autocast('cuda', dtype=torch.bfloat16):
136
+ print(
137
+ pipe('Here is a recipe for vegan banana bread:\n',
138
+ max_new_tokens=100,
139
+ do_sample=True,
140
+ use_cache=True))
141
+ ```
142
+
143
+ ### Formatting
144
+
145
+ This model was trained on data formatted in the dolly-15k format:
146
+
147
+ ```python
148
+ INSTRUCTION_KEY = "### Instruction:"
149
+ RESPONSE_KEY = "### Response:"
150
+ INTRO_BLURB = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
151
+ PROMPT_FOR_GENERATION_FORMAT = """{intro}
152
+ {instruction_key}
153
+ {instruction}
154
+ {response_key}
155
+ """.format(
156
+ intro=INTRO_BLURB,
157
+ instruction_key=INSTRUCTION_KEY,
158
+ instruction="{instruction}",
159
+ response_key=RESPONSE_KEY,
160
+ )
161
+
162
+ example = "James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week? Explain before answering."
163
+ fmt_ex = PROMPT_FOR_GENERATION_FORMAT.format(instruction=example)
164
+ ```
165
+
166
+ In the above example, `fmt_ex` is ready to be tokenized and sent through the model.
167
+
168
+ ## Model Description
169
+
170
+ The architecture is a modification of a standard decoder-only transformer.
171
+
172
+ The model has been modified from a standard transformer in the following ways:
173
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
174
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
175
+ * It does not use biases
176
+
177
+
178
+ | Hyperparameter | Value |
179
+ |----------------|-------|
180
+ |n_parameters | 6.7B |
181
+ |n_layers | 32 |
182
+ | n_heads | 32 |
183
+ | d_model | 4096 |
184
+ | vocab size | 50432 |
185
+ | sequence length | 2048 |
186
+
187
+ ## PreTraining Data
188
+
189
+ For more details on the pretraining process, see [MPT-7B](https://huggingface.co/mosaicml/mpt-7b).
190
+
191
+ The data was tokenized using the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
192
+
193
+ ### Training Configuration
194
+
195
+ This model was trained on 8 A100-40GBs for about 2.3 hours using the [MosaicML Platform](https://www.mosaicml.com/platform).
196
+ The model was trained with sharded data parallelism using [FSDP](https://pytorch.org/docs/stable/fsdp.html) and used the AdamW optimizer.
197
+
198
+ ## Limitations and Biases
199
+
200
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
201
+
202
+ MPT-7B-Instruct can produce factually incorrect output, and should not be relied on to produce factually accurate information.
203
+ MPT-7B-Instruct was trained on various public datasets.
204
+ 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.
205
+
206
+
207
+ ## Acknowledgements
208
+
209
+ This model was finetuned by Sam Havens and the MosaicML NLP team
210
+
211
+ ## MosaicML Platform
212
+
213
+ 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).
214
+
215
+ ## Disclaimer
216
+
217
+ 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.
218
+
219
+ ## Citation
220
+
221
+ Please cite this model using the following format:
222
+
223
+ ```
224
+ @online{MosaicML2023Introducing,
225
+ author = {MosaicML NLP Team},
226
+ title = {Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs},
227
+ year = {2023},
228
+ url = {www.mosaicml.com/blog/mpt-7b},
229
+ note = {Accessed: 2023-03-28}, % change this date
230
+ urldate = {2023-03-28} % change this date
231
+ }
232
+ ```
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:1adb227bbf42f844b27c853a902aa384a770b246c764ce45b4ac836f9cdc9884
3
+ size 6654505904
special_tokens_map.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "unk_token": "<|endoftext|>"
5
+ }
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": 2048,
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