Text Generation
Transformers
Safetensors
English
llama
text-generation-inference
4-bit precision
gptq
TheBloke commited on
Commit
582997e
1 Parent(s): ccb5883

Initial GPTQ model commit

Browse files
Files changed (1) hide show
  1. README.md +267 -0
README.md ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ inference: false
3
+ license: other
4
+ ---
5
+
6
+ <!-- header start -->
7
+ <div style="width: 100%;">
8
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
9
+ </div>
10
+ <div style="display: flex; justify-content: space-between; width: 100%;">
11
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
12
+ <p><a href="https://discord.gg/Jq4vkcDakD">Chat & support: my new Discord server</a></p>
13
+ </div>
14
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
15
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
16
+ </div>
17
+ </div>
18
+ <!-- header end -->
19
+
20
+ # Allen AI's Tulu 7B GPTQ
21
+
22
+ These files are GPTQ 4bit model files for [Allen AI's Tulu 7B](https://huggingface.co/allenai/tulu-7b).
23
+
24
+ It is the result of quantising to 4bit using [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa).
25
+
26
+ ## Repositories available
27
+
28
+ * [4-bit GPTQ models for GPU inference](https://huggingface.co/TheBloke/tulu-7B-GPTQ)
29
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/tulu-7B-GGML)
30
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/TheBloke/tulu-7B-fp16)
31
+
32
+ ## How to easily download and use this model in text-generation-webui
33
+
34
+ Please make sure you're using the latest version of text-generation-webui
35
+
36
+ 1. Click the **Model tab**.
37
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/tulu-7B-GPTQ`.
38
+ 3. Click **Download**.
39
+ 4. The model will start downloading. Once it's finished it will say "Done"
40
+ 5. In the top left, click the refresh icon next to **Model**.
41
+ 6. In the **Model** dropdown, choose the model you just downloaded: `tulu-7B-GPTQ`
42
+ 7. The model will automatically load, and is now ready for use!
43
+ 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.
44
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
45
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
46
+
47
+ ## How to use this GPTQ model from Python code
48
+
49
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
50
+
51
+ `pip install auto-gptq`
52
+
53
+ Then try the following example code:
54
+
55
+ ```python
56
+ from transformers import AutoTokenizer, pipeline, logging
57
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
58
+ import argparse
59
+
60
+ model_name_or_path = "TheBloke/tulu-7B-GPTQ"
61
+ model_basename = "gptq_model-4bit-128g"
62
+
63
+ use_triton = False
64
+
65
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
66
+
67
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
68
+ model_basename=model_basename,
69
+ use_safetensors=True,
70
+ trust_remote_code=True,
71
+ device="cuda:0",
72
+ use_triton=use_triton,
73
+ quantize_config=None)
74
+
75
+ prompt = "Tell me about AI"
76
+ prompt_template=f'''### Human: {prompt}
77
+ ### Assistant:'''
78
+
79
+ print("\n\n*** Generate:")
80
+
81
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
82
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
83
+ print(tokenizer.decode(output[0]))
84
+
85
+ # Inference can also be done using transformers' pipeline
86
+
87
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
88
+ logging.set_verbosity(logging.CRITICAL)
89
+
90
+ print("*** Pipeline:")
91
+ pipe = pipeline(
92
+ "text-generation",
93
+ model=model,
94
+ tokenizer=tokenizer,
95
+ max_new_tokens=512,
96
+ temperature=0.7,
97
+ top_p=0.95,
98
+ repetition_penalty=1.15
99
+ )
100
+
101
+ print(pipe(prompt_template)[0]['generated_text'])
102
+ ```
103
+
104
+ ## Provided files
105
+
106
+ **gptq_model-4bit-128g.safetensors**
107
+
108
+ This will work with AutoGPTQ and CUDA versions of GPTQ-for-LLaMa. There are reports of issues with Triton mode of recent GPTQ-for-LLaMa. If you have issues, please use AutoGPTQ instead.
109
+
110
+ It was created with group_size 128 to increase inference accuracy, but without --act-order (desc_act) to increase compatibility and improve inference speed.
111
+
112
+ * `gptq_model-4bit-128g.safetensors`
113
+ * Works with AutoGPTQ in CUDA or Triton modes.
114
+ * Works with GPTQ-for-LLaMa in CUDA mode. May have issues with GPTQ-for-LLaMa Triton mode.
115
+ * Works with text-generation-webui, including one-click-installers.
116
+ * Parameters: Groupsize = 128. Act Order / desc_act = False.
117
+
118
+ <!-- footer start -->
119
+ ## Discord
120
+
121
+ For further support, and discussions on these models and AI in general, join us at:
122
+
123
+ [TheBloke AI's Discord server](https://discord.gg/Jq4vkcDakD)
124
+
125
+ ## Thanks, and how to contribute.
126
+
127
+ Thanks to the [chirper.ai](https://chirper.ai) team!
128
+
129
+ 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.
130
+
131
+ 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.
132
+
133
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
134
+
135
+ * Patreon: https://patreon.com/TheBlokeAI
136
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
137
+
138
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz, Dmitriy Samsonov.
139
+
140
+ **Patreon special mentions**: Oscar Rangel, Eugene Pentland, Talal Aujan, Cory Kujawski, Luke, Asp the Wyvern, Ai Maven, Pyrater, Alps Aficionado, senxiiz, Willem Michiel, Junyu Yang, trip7s trip, Sebastain Graf, Joseph William Delisle, Lone Striker, Jonathan Leane, Johann-Peter Hartmann, David Flickinger, Spiking Neurons AB, Kevin Schuppel, Mano Prime, Dmitriy Samsonov, Sean Connelly, Nathan LeClaire, Alain Rossmann, Fen Risland, Derek Yates, Luke Pendergrass, Nikolai Manek, Khalefa Al-Ahmad, Artur Olbinski, John Detwiler, Ajan Kanaga, Imad Khwaja, Trenton Dambrowitz, Kalila, vamX, webtim, Illia Dulskyi.
141
+
142
+ Thank you to all my generous patrons and donaters!
143
+
144
+ <!-- footer end -->
145
+
146
+ # Original model card: Allen AI's Tulu 7B
147
+
148
+
149
+ # Tulu 7B
150
+
151
+ This model is a 7B LLaMa model finetuned on a mixture of instruction datasets (FLAN V2, CoT, Dolly, Open Assistant 1, GPT4-Alpaca, Code-Alpaca, and ShareGPT).
152
+ *Please note this is a model diff - see below for usage instructions*.
153
+
154
+ This was trained as part of the paper [How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources](https://arxiv.org/abs/2306.04751).
155
+ The codebase used to train and evaluate this model can be found at [https://github.com/allenai/open-instruct](https://github.com/allenai/open-instruct).
156
+
157
+ This model is licensed under the AI model license given in LICENSE.txt along with the original Llama license (llama_license.txt).
158
+
159
+ ## Usage
160
+
161
+ We assume you have access to a LLaMa model in HF format already. You can find details on getting access and converting the model here:
162
+ [https://huggingface.co/docs/transformers/main/model_doc/llama](https://huggingface.co/docs/transformers/main/model_doc/llama)
163
+
164
+ Clone [https://github.com/allenai/open-instruct](https://github.com/allenai/open-instruct) and install the required dependencies, or just copy `scripts/weight_diff.py`
165
+ and install the minimal requirements listed in `weight-diff-requirements.txt`. Then download or clone this model diff to the same machine.
166
+
167
+ Then, run:
168
+ ```bash
169
+ python scripts/weight_diff.py recover --path_raw ${hf_llama_path} --path_tuned ${output_path} --path_diff ${diff_location}
170
+ ```
171
+
172
+ And you will have a recovered model! Note this takes up a decent amount of RAM, especially for the larger models.
173
+
174
+ ## Input Format
175
+
176
+ The model is trained to use the following format (note the newlines):
177
+ ```
178
+ <|user|>
179
+ Your message here!
180
+ <|assistant|>
181
+ ```
182
+
183
+ For best results, format all inputs in this manner.
184
+
185
+ ## Performance
186
+
187
+ Here is the performance of this model across benchmarks explored in our paper [How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources](https://arxiv.org/abs/2306.04751):
188
+
189
+ | MMLU 0-shot | MMLU 5-shot | GSM Direct | GSM CoT | BBH Direct | BBH CoT | TydiQA Gold-Passage | TydiQA Closed-book | Codex-Eval Pass@1 | Codex-Eval Pass@10 | AlpacaFarm vs Davinci-003 | Average |
190
+ |:-----------:|:-----------:|:----------:|:-------:|:----------:|:-------:|:-------------------:|:------------------:|:-----------------:|:------------------:|:-------------------------:|---------|
191
+ | 44.5 | 47.0 | 6.0 | 27.0 | 38.1 | 39.2 | 45.7 | 7.7 | 17.5 | 27.8 | 48.3 | 33.1 |
192
+
193
+ If you use this model, please cite our work, the llama paper, and the original datasets:
194
+
195
+ ```
196
+ @misc{wang2023far,
197
+ title={How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources},
198
+ author={Yizhong Wang and Hamish Ivison and Pradeep Dasigi and Jack Hessel and Tushar Khot and Khyathi Raghavi Chandu and David Wadden and Kelsey MacMillan and Noah A. Smith and Iz Beltagy and Hannaneh Hajishirzi},
199
+ year={2023},
200
+ eprint={2306.04751},
201
+ archivePrefix={arXiv},
202
+ primaryClass={cs.CL}
203
+ }
204
+ ```
205
+
206
+ ```
207
+ @misc{touvron2023llama,
208
+ title={LLaMA: Open and Efficient Foundation Language Models},
209
+ author={Hugo Touvron and Thibaut Lavril and Gautier Izacard and Xavier Martinet and Marie-Anne Lachaux and Timothée Lacroix and Baptiste Rozière and Naman Goyal and Eric Hambro and Faisal Azhar and Aurelien Rodriguez and Armand Joulin and Edouard Grave and Guillaume Lample},
210
+ year={2023},
211
+ eprint={2302.13971},
212
+ archivePrefix={arXiv},
213
+ primaryClass={cs.CL}
214
+ }
215
+ ```
216
+
217
+ ```
218
+ @misc{dolly,
219
+ author = {Databricks},
220
+ title = {Free Dolly: Introducing the World's First Truly Open Instruction-Tuned LLM},
221
+ year = {2023},
222
+ publisher = {GitHub},
223
+ journal = {GitHub repository},
224
+ howpublished = {Blog post},
225
+ url = {https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm}
226
+ }
227
+ ```
228
+
229
+ ```
230
+ @article{longpre2023flan,
231
+ title={The Flan Collection: Designing Data and Methods for Effective Instruction Tuning},
232
+ author={Longpre, Shayne and Hou, Le and Vu, Tu and Webson, Albert and Chung, Hyung Won and Tay, Yi and Zhou, Denny and Le, Quoc V and Zoph, Barret and Wei, Jason and others},
233
+ journal={arXiv preprint arXiv:2301.13688},
234
+ year={2023}
235
+ }
236
+ ```
237
+
238
+ ```
239
+ @misc{köpf2023openassistant,
240
+ title={OpenAssistant Conversations -- Democratizing Large Language Model Alignment},
241
+ author={Andreas Köpf and Yannic Kilcher and Dimitri von Rütte and Sotiris Anagnostidis and Zhi-Rui Tam and Keith Stevens and Abdullah Barhoum and Nguyen Minh Duc and Oliver Stanley and Richárd Nagyfi and Shahul ES and Sameer Suri and David Glushkov and Arnav Dantuluri and Andrew Maguire and Christoph Schuhmann and Huu Nguyen and Alexander Mattick},
242
+ year={2023},
243
+ eprint={2304.07327},
244
+ archivePrefix={arXiv},
245
+ primaryClass={cs.CL}
246
+ }
247
+ ```
248
+
249
+ ```
250
+ @article{peng2023instruction,
251
+ title={Instruction Tuning with GPT-4},
252
+ author={Peng, Baolin and Li, Chunyuan and He, Pengcheng and Galley, Michel and Gao, Jianfeng},
253
+ journal={arXiv preprint arXiv:2304.03277},
254
+ year={2023}
255
+ }
256
+ ```
257
+
258
+ ```
259
+ @misc{codealpaca,
260
+ author = {Sahil Chaudhary},
261
+ title = {Code Alpaca: An Instruction-following LLaMA model for code generation},
262
+ year = {2023},
263
+ publisher = {GitHub},
264
+ journal = {GitHub repository},
265
+ howpublished = {\url{https://github.com/sahil280114/codealpaca}},
266
+ }
267
+ ```