TheBloke commited on
Commit
de1649f
1 Parent(s): fc0f39d

Initial GPTQ model commit

Browse files
Files changed (1) hide show
  1. README.md +263 -0
README.md ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - guanaco
4
+ inference: false
5
+ language:
6
+ - en
7
+ license:
8
+ - apache-2.0
9
+ model_hub_library:
10
+ - transformers
11
+ model_type: starcoder
12
+ ---
13
+
14
+ <!-- header start -->
15
+ <div style="width: 100%;">
16
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
17
+ </div>
18
+ <div style="display: flex; justify-content: space-between; width: 100%;">
19
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
20
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
21
+ </div>
22
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
23
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
24
+ </div>
25
+ </div>
26
+ <!-- header end -->
27
+
28
+ # LoupGarou's Starcoderplus Guanaco GPT4 15B V1.0 GPTQ
29
+
30
+ These files are GPTQ model files for [LoupGarou's Starcoderplus Guanaco GPT4 15B V1.0](https://huggingface.co/LoupGarou/Starcoderplus-Guanaco-GPT4-15B-V1.0).
31
+
32
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
33
+
34
+ These models were quantised using hardware kindly provided by [Latitude.sh](https://www.latitude.sh/accelerate).
35
+
36
+ ## Repositories available
37
+
38
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ)
39
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GGML)
40
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/LoupGarou/Starcoderplus-Guanaco-GPT4-15B-V1.0)
41
+
42
+ ## Prompt template: Guanaco
43
+
44
+ ```
45
+ ### Human: {prompt}
46
+ ### Assistant:
47
+ ```
48
+
49
+ ## Provided files
50
+
51
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
52
+
53
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
54
+
55
+ | Branch | Bits | Group Size | Act Order (desc_act) | File Size | ExLlama Compatible? | Made With | Description |
56
+ | ------ | ---- | ---------- | -------------------- | --------- | ------------------- | --------- | ----------- |
57
+ | main | 4 | 128 | False | 9.20 GB | False | AutoGPTQ | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
58
+ | gptq-4bit-64g-actorder_True | 4 | 64 | True | 9.49 GB | False | AutoGPTQ | 4-bit, with Act Order and group size. 64g uses less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
59
+ | gptq-4bit-128g-actorder_True | 4 | 128 | True | 9.20 GB | False | AutoGPTQ | 4-bit, with Act Order and group size. 128g uses even less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
60
+ | gptq-8bit--1g-actorder_True | 8 | None | True | 16.49 GB | False | AutoGPTQ | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
61
+ | gptq-8bit-128g-actorder_-1 | 8 | 128 | -1 | 16.84 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
62
+
63
+ ## How to download from branches
64
+
65
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ:gptq-4bit-64g-actorder_True`
66
+ - With Git, you can clone a branch with:
67
+ ```
68
+ git clone --branch gptq-4bit-64g-actorder_True https://huggingface.co/TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ`
69
+ ```
70
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
71
+
72
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
73
+
74
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
75
+
76
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
77
+
78
+ 1. Click the **Model tab**.
79
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ`.
80
+ - To download from a specific branch, enter for example `TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ:gptq-4bit-64g-actorder_True`
81
+ - see Provided Files above for the list of branches for each option.
82
+ 3. Click **Download**.
83
+ 4. The model will start downloading. Once it's finished it will say "Done"
84
+ 5. In the top left, click the refresh icon next to **Model**.
85
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ`
86
+ 7. The model will automatically load, and is now ready for use!
87
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
88
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
89
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
90
+
91
+ ## How to use this GPTQ model from Python code
92
+
93
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
94
+
95
+ `GITHUB_ACTIONS=true pip install auto-gptq`
96
+
97
+ Then try the following example code:
98
+
99
+ ```python
100
+ from transformers import AutoTokenizer, pipeline, logging
101
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
102
+
103
+ model_name_or_path = "TheBloke/Starcoderplus-Guanaco-GPT4-15B-V1.0-GPTQ"
104
+ model_basename = "gptq_model-4bit-128g"
105
+
106
+ use_triton = False
107
+
108
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
109
+
110
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
111
+ model_basename=model_basename
112
+ use_safetensors=True,
113
+ trust_remote_code=True,
114
+ device="cuda:0",
115
+ use_triton=use_triton,
116
+ quantize_config=None)
117
+
118
+ """
119
+ To download from a specific branch, use the revision parameter, as in this example:
120
+
121
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
122
+ revision="gptq-4bit-64g-actorder_True",
123
+ model_basename=model_basename,
124
+ use_safetensors=True,
125
+ trust_remote_code=True,
126
+ device="cuda:0",
127
+ quantize_config=None)
128
+ """
129
+
130
+ prompt = "Tell me about AI"
131
+ prompt_template=f'''### Human: {prompt}
132
+ ### Assistant:
133
+ '''
134
+
135
+ print("\n\n*** Generate:")
136
+
137
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
138
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
139
+ print(tokenizer.decode(output[0]))
140
+
141
+ # Inference can also be done using transformers' pipeline
142
+
143
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
144
+ logging.set_verbosity(logging.CRITICAL)
145
+
146
+ print("*** Pipeline:")
147
+ pipe = pipeline(
148
+ "text-generation",
149
+ model=model,
150
+ tokenizer=tokenizer,
151
+ max_new_tokens=512,
152
+ temperature=0.7,
153
+ top_p=0.95,
154
+ repetition_penalty=1.15
155
+ )
156
+
157
+ print(pipe(prompt_template)[0]['generated_text'])
158
+ ```
159
+
160
+ ## Compatibility
161
+
162
+ The files provided will work with AutoGPTQ (CUDA and Triton modes), GPTQ-for-LLaMa (only CUDA has been tested), and Occ4m's GPTQ-for-LLaMa fork.
163
+
164
+ ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
165
+
166
+ <!-- footer start -->
167
+ ## Discord
168
+
169
+ For further support, and discussions on these models and AI in general, join us at:
170
+
171
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
172
+
173
+ ## Thanks, and how to contribute.
174
+
175
+ Thanks to the [chirper.ai](https://chirper.ai) team!
176
+
177
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
178
+
179
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
180
+
181
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
182
+
183
+ * Patreon: https://patreon.com/TheBlokeAI
184
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
185
+
186
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
187
+
188
+ **Patreon special mentions**: Space Cruiser, Nikolai Manek, Sam, Chris McCloskey, Rishabh Srivastava, Kalila, Spiking Neurons AB, Khalefa Al-Ahmad, WelcomeToTheClub, Chadd, Lone Striker, Viktor Bowallius, Edmond Seymore, Ai Maven, Chris Smitley, Dave, Alexandros Triantafyllidis, Luke @flexchar, Elle, ya boyyy, Talal Aujan, Alex , Jonathan Leane, Deep Realms, Randy H, subjectnull, Preetika Verma, Joseph William Delisle, Michael Levine, chris gileta, K, Oscar Rangel, LangChain4j, Trenton Dambrowitz, Eugene Pentland, Johann-Peter Hartmann, Femi Adebogun, Illia Dulskyi, senxiiz, Daniel P. Andersen, Sean Connelly, Artur Olbinski, RoA, Mano Prime, Derek Yates, Raven Klaugh, David Flickinger, Willem Michiel, Pieter, Willian Hasse, vamX, Luke Pendergrass, webtim, Ghost , Rainer Wilmers, Nathan LeClaire, Will Dee, Cory Kujawski, John Detwiler, Fred von Graf, biorpg, Iucharbius , Imad Khwaja, Pierre Kircher, terasurfer , Asp the Wyvern, John Villwock, theTransient, zynix , Gabriel Tamborski, Fen Risland, Gabriel Puliatti, Matthew Berman, Pyrater, SuperWojo, Stephen Murray, Karl Bernard, Ajan Kanaga, Greatston Gnanesh, Junyu Yang.
189
+
190
+ Thank you to all my generous patrons and donaters!
191
+
192
+ <!-- footer end -->
193
+
194
+ # Original model card: LoupGarou's Starcoderplus Guanaco GPT4 15B V1.0
195
+
196
+
197
+ ## Starcoderplus-Guanaco-GPT4-15B-V1.0 Model Card
198
+ Starcoderplus-Guanaco-GPT4-15B-V1.0 is a language model that combines the strengths of the [Starcoderplus](https://huggingface.co/bigcode/starcoderplus) base model, an expansion of the orginal [openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco) dataset re-imagined using 100% GPT-4 answers, and additional data on abstract algebra and physics for finetuning. The original openassistant-guanaco dataset questions were trimmed to within 2 standard deviations of token size for input and output pairs and all non-english data was been removed to reduce training size requirements.
199
+
200
+ # Model Description
201
+ This model is built on top of the Starcoderplus base model, a large language model which is a fine-tuned version of [StarCoderBase](https://huggingface.co/bigcode/starcoderbase). The Starcoderplus base model was further finetuned using QLORA on the revised openassistant-guanaco dataset questions that were 100% re-imagined using GPT-4.
202
+
203
+ # Intended Use
204
+ This model is designed to be used for a wide array of text generation tasks that require understanding and generating English text. The model is expected to perform well in tasks such as answering questions, writing essays, summarizing text, translation, and more. However, given the specific data processing and finetuning done, it might be particularly effective for tasks related to English language question-answering systems.
205
+
206
+ # Limitations
207
+ Despite the powerful capabilities of this model, users should be aware of its limitations. The model's knowledge is up to date only until the time it was trained, and it doesn't know about events in the world after that. It can sometimes produce incorrect or nonsensical responses, as it doesn't understand the text in the same way humans do. It should be used as a tool to assist in generating text and not as a sole source of truth.
208
+
209
+ # How to use
210
+ Here is an example of how to use this model:
211
+
212
+ ```python
213
+ from transformers import AutoModelForCausalLM, AutoTokenizer
214
+ import time
215
+ import torch
216
+
217
+ class Chatbot:
218
+ def __init__(self, model_name):
219
+ self.tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side='left')
220
+ self.model = AutoModelForCausalLM.from_pretrained(model_name, load_in_4bit=True, torch_dtype=torch.bfloat16)
221
+ if self.tokenizer.pad_token_id is None:
222
+ self.tokenizer.pad_token_id = self.tokenizer.eos_token_id
223
+
224
+ def get_response(self, prompt):
225
+ inputs = self.tokenizer.encode_plus(prompt, return_tensors="pt", padding='max_length', max_length=100)
226
+ if next(self.model.parameters()).is_cuda:
227
+ inputs = {name: tensor.to('cuda') for name, tensor in inputs.items()}
228
+ start_time = time.time()
229
+ tokens = self.model.generate(input_ids=inputs['input_ids'],
230
+ attention_mask=inputs['attention_mask'],
231
+ pad_token_id=self.tokenizer.pad_token_id,
232
+ max_new_tokens=400)
233
+ end_time = time.time()
234
+ output_tokens = tokens[0][inputs['input_ids'].shape[-1]:]
235
+ output = self.tokenizer.decode(output_tokens, skip_special_tokens=True)
236
+ time_taken = end_time - start_time
237
+ return output, time_taken
238
+
239
+ def main():
240
+ chatbot = Chatbot("LoupGarou/Starcoderplus-Guanaco-GPT4-15B-V1.0")
241
+ while True:
242
+ user_input = input("Enter your prompt: ")
243
+ if user_input.lower() == 'quit':
244
+ break
245
+ output, time_taken = chatbot.get_response(user_input)
246
+ print("\033[33m" + output + "\033[0m")
247
+ print("Time taken to process: ", time_taken, "seconds")
248
+ print("Exited the program.")
249
+
250
+ if __name__ == "__main__":
251
+ main()
252
+
253
+ ```
254
+
255
+ # Training Procedure
256
+ The base Starcoderplus model was finetuned on the modified openassistant-guanaco dataset 100% re-imagined with GPT4 answers using QLORA. All non-English data was also removed from this finetuning dataset to reduce trainign size and time.
257
+
258
+ ## Acknowledgements
259
+ This model, Starcoderplus-Guanaco-GPT4-15B-V1.0, builds upon the strengths of the [Starcoderplus](https://huggingface.co/bigcode/starcoderplus) and the [openassistant-guanaco dataset](https://huggingface.co/datasets/timdettmers/openassistant-guanaco).
260
+
261
+ A sincere appreciation goes out to the developers and the community involved in the creation and refinement of these models. Their commitment to providing open source tools and datasets have been instrumental in making this project a reality.
262
+
263
+ Moreover, a special note of thanks to the [Hugging Face](https://huggingface.co/) team, whose transformative library has not only streamlined the process of model creation and adaptation, but also democratized the access to state-of-the-art machine learning technologies. Their impact on the development of this project cannot be overstated.