GGUF
Composer
MosaicML
llm-foundry
filipealmeida commited on
Commit
323baf3
1 Parent(s): 4783fc2

Upload folder using huggingface_hub (#1)

Browse files

- Upload folder using huggingface_hub (8bd05b0a72b02cf6b7a28c7d538d1ef1777ec179)

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