GGUF
Composer
MosaicML
llm-foundry
mav23 commited on
Commit
2e04451
·
verified ·
1 Parent(s): afb81bb

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +210 -0
  3. mpt-7b-instruct.Q4_0.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ mpt-7b-instruct.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - mosaicml/dolly_hhrlhf
5
+ tags:
6
+ - Composer
7
+ - MosaicML
8
+ - llm-foundry
9
+ inference: false
10
+ ---
11
+
12
+ # MPT-7B-Instruct
13
+
14
+ MPT-7B-Instruct is a model for short-form instruction following.
15
+ 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.
16
+ * License: Apache 2.0
17
+ * [Demo on Hugging Face Spaces](https://huggingface.co/spaces/mosaicml/mpt-7b-instruct)
18
+
19
+
20
+ This model was trained by [MosaicML](https://www.mosaicml.com) and follows a modified decoder-only transformer architecture.
21
+
22
+ ## Model Date
23
+
24
+ May 5, 2023
25
+
26
+ ## Model License
27
+
28
+ Apache 2.0
29
+
30
+ ## Documentation
31
+
32
+ * [Blog post: Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs](https://www.mosaicml.com/blog/mpt-7b)
33
+ * [Codebase (mosaicml/llm-foundry repo)](https://github.com/mosaicml/llm-foundry/)
34
+ * Questions: Feel free to contact us via the [MosaicML Community Slack](https://mosaicml.me/slack)!
35
+
36
+ ### Example Question/Instruction
37
+
38
+ **Longboi24**:
39
+ > What is a quoll?
40
+
41
+ **MPT-7B-Instruct**:
42
+
43
+ >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
44
+
45
+ ## How to Use
46
+
47
+ 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.
48
+
49
+ 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.
50
+
51
+ ```python
52
+ import transformers
53
+ model = transformers.AutoModelForCausalLM.from_pretrained(
54
+ 'mosaicml/mpt-7b-instruct',
55
+ trust_remote_code=True
56
+ )
57
+ ```
58
+ Note: This model requires that `trust_remote_code=True` be passed to the `from_pretrained` method.
59
+ This is because we use a custom `MPT` model architecture that is not yet part of the Hugging Face `transformers` package.
60
+ `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.
61
+
62
+ 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:
63
+ ```python
64
+ import torch
65
+ import transformers
66
+
67
+ name = 'mosaicml/mpt-7b-instruct'
68
+
69
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
70
+ config.attn_config['attn_impl'] = 'triton'
71
+ config.init_device = 'cuda:0' # For fast initialization directly on GPU!
72
+
73
+ model = transformers.AutoModelForCausalLM.from_pretrained(
74
+ name,
75
+ config=config,
76
+ torch_dtype=torch.bfloat16, # Load model weights in bfloat16
77
+ trust_remote_code=True
78
+ )
79
+ ```
80
+
81
+ 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:
82
+
83
+ ```python
84
+ import transformers
85
+
86
+ name = 'mosaicml/mpt-7b-instruct'
87
+
88
+ config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
89
+ config.max_seq_len = 4096 # (input + output) tokens can now be up to 4096
90
+
91
+ model = transformers.AutoModelForCausalLM.from_pretrained(
92
+ name,
93
+ config=config,
94
+ trust_remote_code=True
95
+ )
96
+ ```
97
+
98
+ This model was trained with the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
99
+
100
+ ```python
101
+ from transformers import AutoTokenizer
102
+ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
103
+ ```
104
+
105
+ The model can then be used, for example, within a text-generation pipeline.
106
+ 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).
107
+
108
+ ```python
109
+ from transformers import pipeline
110
+
111
+ pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
112
+
113
+ with torch.autocast('cuda', dtype=torch.bfloat16):
114
+ print(
115
+ pipe('Here is a recipe for vegan banana bread:\n',
116
+ max_new_tokens=100,
117
+ do_sample=True,
118
+ use_cache=True))
119
+ ```
120
+
121
+ ### Formatting
122
+
123
+ This model was trained on data formatted in the dolly-15k format:
124
+
125
+ ```python
126
+ INSTRUCTION_KEY = "### Instruction:"
127
+ RESPONSE_KEY = "### Response:"
128
+ INTRO_BLURB = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
129
+ PROMPT_FOR_GENERATION_FORMAT = """{intro}
130
+ {instruction_key}
131
+ {instruction}
132
+ {response_key}
133
+ """.format(
134
+ intro=INTRO_BLURB,
135
+ instruction_key=INSTRUCTION_KEY,
136
+ instruction="{instruction}",
137
+ response_key=RESPONSE_KEY,
138
+ )
139
+
140
+ 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."
141
+ fmt_ex = PROMPT_FOR_GENERATION_FORMAT.format(instruction=example)
142
+ ```
143
+
144
+ In the above example, `fmt_ex` is ready to be tokenized and sent through the model.
145
+
146
+ ## Model Description
147
+
148
+ The architecture is a modification of a standard decoder-only transformer.
149
+
150
+ The model has been modified from a standard transformer in the following ways:
151
+ * It uses [FlashAttention](https://arxiv.org/pdf/2205.14135.pdf)
152
+ * It uses [ALiBi (Attention with Linear Biases)](https://arxiv.org/abs/2108.12409) and does not use positional embeddings
153
+ * It does not use biases
154
+
155
+
156
+ | Hyperparameter | Value |
157
+ |----------------|-------|
158
+ |n_parameters | 6.7B |
159
+ |n_layers | 32 |
160
+ | n_heads | 32 |
161
+ | d_model | 4096 |
162
+ | vocab size | 50432 |
163
+ | sequence length | 2048 |
164
+
165
+ ## PreTraining Data
166
+
167
+ For more details on the pretraining process, see [MPT-7B](https://huggingface.co/mosaicml/mpt-7b).
168
+
169
+ The data was tokenized using the [EleutherAI/gpt-neox-20b](https://huggingface.co/EleutherAI/gpt-neox-20b) tokenizer.
170
+
171
+ ### Training Configuration
172
+
173
+ This model was trained on 8 A100-40GBs for about 2.3 hours using the [MosaicML Platform](https://www.mosaicml.com/platform).
174
+ The model was trained with sharded data parallelism using [FSDP](https://pytorch.org/docs/stable/fsdp.html) and used the AdamW optimizer.
175
+
176
+ ## Limitations and Biases
177
+
178
+ _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
179
+
180
+ MPT-7B-Instruct can produce factually incorrect output, and should not be relied on to produce factually accurate information.
181
+ MPT-7B-Instruct was trained on various public datasets.
182
+ 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.
183
+
184
+
185
+ ## Acknowledgements
186
+
187
+ This model was finetuned by Sam Havens and the MosaicML NLP team
188
+
189
+ ## MosaicML Platform
190
+
191
+ 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).
192
+
193
+ ## Disclaimer
194
+
195
+ 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.
196
+
197
+ ## Citation
198
+
199
+ Please cite this model using the following format:
200
+
201
+ ```
202
+ @online{MosaicML2023Introducing,
203
+ author = {MosaicML NLP Team},
204
+ title = {Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs},
205
+ year = {2023},
206
+ url = {www.mosaicml.com/blog/mpt-7b},
207
+ note = {Accessed: 2023-03-28}, % change this date
208
+ urldate = {2023-03-28} % change this date
209
+ }
210
+ ```
mpt-7b-instruct.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c89355d1dbbd2a55b2238de348cab4af4a68600c2cc955cd6a185bbba5ac740b
3
+ size 3796178496