TheBloke commited on
Commit
e8a7209
1 Parent(s): c0fb4ca

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +321 -0
README.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: LeoLM/leo-hessianai-7b
3
+ datasets:
4
+ - oscar-corpus/OSCAR-2301
5
+ - wikipedia
6
+ - bjoernp/tagesschau-2018-2023
7
+ inference: false
8
+ language:
9
+ - en
10
+ - de
11
+ library_name: transformers
12
+ license: llama2
13
+ model_creator: LAION LeoLM
14
+ model_name: Leo Hessianai 7B
15
+ model_type: llama
16
+ pipeline_tag: text-generation
17
+ prompt_template: '{prompt}
18
+
19
+ '
20
+ quantized_by: TheBloke
21
+ ---
22
+
23
+ <!-- header start -->
24
+ <!-- 200823 -->
25
+ <div style="width: auto; margin-left: auto; margin-right: auto">
26
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
27
+ </div>
28
+ <div style="display: flex; justify-content: space-between; width: 100%;">
29
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
30
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
31
+ </div>
32
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
34
+ </div>
35
+ </div>
36
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
37
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
38
+ <!-- header end -->
39
+
40
+ # Leo Hessianai 7B - AWQ
41
+ - Model creator: [LAION LeoLM](https://huggingface.co/LeoLM)
42
+ - Original model: [Leo Hessianai 7B](https://huggingface.co/LeoLM/leo-hessianai-7b)
43
+
44
+ <!-- description start -->
45
+ ## Description
46
+
47
+ This repo contains AWQ model files for [LAION LeoLM's Leo Hessianai 7B](https://huggingface.co/LeoLM/leo-hessianai-7b).
48
+
49
+
50
+ ### About AWQ
51
+
52
+ AWQ is an efficient, accurate and blazing-fast low-bit weight quantization method, currently supporting 4-bit quantization. Compared to GPTQ, it offers faster Transformers-based inference.
53
+
54
+ It is also now supported by continuous batching server [vLLM](https://github.com/vllm-project/vllm), allowing use of Llama AWQ models for high-throughput concurrent inference in multi-user server scenarios.
55
+
56
+ As of September 25th 2023, preliminary Llama-only AWQ support has also been added to [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference).
57
+
58
+ Note that, at the time of writing, overall throughput is still lower than running vLLM or TGI with unquantised models, however using AWQ enables using much smaller GPUs which can lead to easier deployment and overall cost savings. For example, a 70B model can be run on 1 x 48GB GPU instead of 2 x 80GB.
59
+ <!-- description end -->
60
+ <!-- repositories-available start -->
61
+ ## Repositories available
62
+
63
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/leo-hessianai-7B-AWQ)
64
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/leo-hessianai-7B-GPTQ)
65
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/leo-hessianai-7B-GGUF)
66
+ * [LAION LeoLM's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/LeoLM/leo-hessianai-7b)
67
+ <!-- repositories-available end -->
68
+
69
+ <!-- prompt-template start -->
70
+ ## Prompt template: None
71
+
72
+ ```
73
+ {prompt}
74
+
75
+ ```
76
+
77
+ <!-- prompt-template end -->
78
+
79
+
80
+ <!-- README_AWQ.md-provided-files start -->
81
+ ## Provided files, and AWQ parameters
82
+
83
+ For my first release of AWQ models, I am releasing 128g models only. I will consider adding 32g as well if there is interest, and once I have done perplexity and evaluation comparisons, but at this time 32g models are still not fully tested with AutoAWQ and vLLM.
84
+
85
+ Models are released as sharded safetensors files.
86
+
87
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
88
+ | ------ | ---- | -- | ----------- | ------- | ---- |
89
+ | [main](https://huggingface.co/TheBloke/leo-hessianai-7B-AWQ/tree/main) | 4 | 128 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 3.89 GB
90
+
91
+ <!-- README_AWQ.md-provided-files end -->
92
+
93
+ <!-- README_AWQ.md-use-from-vllm start -->
94
+ ## Serving this model from vLLM
95
+
96
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
97
+
98
+ Note: at the time of writing, vLLM has not yet done a new release with AWQ support.
99
+
100
+ If you try the vLLM examples below and get an error about `quantization` being unrecognised, or other AWQ-related issues, please install vLLM from Github source.
101
+
102
+ - When using vLLM as a server, pass the `--quantization awq` parameter, for example:
103
+
104
+ ```shell
105
+ python3 python -m vllm.entrypoints.api_server --model TheBloke/leo-hessianai-7B-AWQ --quantization awq --dtype half
106
+ ```
107
+
108
+ When using vLLM from Python code, pass the `quantization=awq` parameter, for example:
109
+
110
+ ```python
111
+ from vllm import LLM, SamplingParams
112
+
113
+ prompts = [
114
+ "Hello, my name is",
115
+ "The president of the United States is",
116
+ "The capital of France is",
117
+ "The future of AI is",
118
+ ]
119
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
120
+
121
+ llm = LLM(model="TheBloke/leo-hessianai-7B-AWQ", quantization="awq", dtype="half")
122
+
123
+ outputs = llm.generate(prompts, sampling_params)
124
+
125
+ # Print the outputs.
126
+ for output in outputs:
127
+ prompt = output.prompt
128
+ generated_text = output.outputs[0].text
129
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
130
+ ```
131
+ <!-- README_AWQ.md-use-from-vllm start -->
132
+
133
+ <!-- README_AWQ.md-use-from-python start -->
134
+ ## Serving this model from TGI
135
+
136
+ TGI merged support for AWQ on September 25th, 2023. At the time of writing you need to use the `:latest` Docker container: `ghcr.io/huggingface/text-generation-inference:latest`
137
+
138
+ Add the parameter `--quantize awq` for AWQ support.
139
+
140
+ Example parameters:
141
+ ```shell
142
+ --model-id TheBloke/leo-hessianai-7B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
143
+ ```
144
+
145
+ ## How to use this AWQ model from Python code
146
+
147
+ ### Install the necessary packages
148
+
149
+ Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.0.2 or later
150
+
151
+ ```shell
152
+ pip3 install autoawq
153
+ ```
154
+
155
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
156
+
157
+ ```shell
158
+ pip3 uninstall -y autoawq
159
+ git clone https://github.com/casper-hansen/AutoAWQ
160
+ cd AutoAWQ
161
+ pip3 install .
162
+ ```
163
+
164
+ ### You can then try the following example code
165
+
166
+ ```python
167
+ from awq import AutoAWQForCausalLM
168
+ from transformers import AutoTokenizer
169
+
170
+ model_name_or_path = "TheBloke/leo-hessianai-7B-AWQ"
171
+
172
+ # Load model
173
+ model = AutoAWQForCausalLM.from_quantized(model_name_or_path, fuse_layers=True,
174
+ trust_remote_code=False, safetensors=True)
175
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=False)
176
+
177
+ prompt = "Tell me about AI"
178
+ prompt_template=f'''{prompt}
179
+
180
+ '''
181
+
182
+ print("\n\n*** Generate:")
183
+
184
+ tokens = tokenizer(
185
+ prompt_template,
186
+ return_tensors='pt'
187
+ ).input_ids.cuda()
188
+
189
+ # Generate output
190
+ generation_output = model.generate(
191
+ tokens,
192
+ do_sample=True,
193
+ temperature=0.7,
194
+ top_p=0.95,
195
+ top_k=40,
196
+ max_new_tokens=512
197
+ )
198
+
199
+ print("Output: ", tokenizer.decode(generation_output[0]))
200
+
201
+ """
202
+ # Inference should be possible with transformers pipeline as well in future
203
+ # But currently this is not yet supported by AutoAWQ (correct as of September 25th 2023)
204
+ from transformers import pipeline
205
+
206
+ print("*** Pipeline:")
207
+ pipe = pipeline(
208
+ "text-generation",
209
+ model=model,
210
+ tokenizer=tokenizer,
211
+ max_new_tokens=512,
212
+ do_sample=True,
213
+ temperature=0.7,
214
+ top_p=0.95,
215
+ top_k=40,
216
+ repetition_penalty=1.1
217
+ )
218
+
219
+ print(pipe(prompt_template)[0]['generated_text'])
220
+ """
221
+ ```
222
+ <!-- README_AWQ.md-use-from-python end -->
223
+
224
+ <!-- README_AWQ.md-compatibility start -->
225
+ ## Compatibility
226
+
227
+ The files provided are tested to work with:
228
+
229
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)
230
+ - [vLLM](https://github.com/vllm-project/vllm)
231
+ - [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
232
+
233
+ TGI merged AWQ support on September 25th, 2023: [TGI PR #1054](https://github.com/huggingface/text-generation-inference/pull/1054). Use the `:latest` Docker container until the next TGI release is made.
234
+
235
+ <!-- README_AWQ.md-compatibility end -->
236
+
237
+ <!-- footer start -->
238
+ <!-- 200823 -->
239
+ ## Discord
240
+
241
+ For further support, and discussions on these models and AI in general, join us at:
242
+
243
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
244
+
245
+ ## Thanks, and how to contribute
246
+
247
+ Thanks to the [chirper.ai](https://chirper.ai) team!
248
+
249
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
250
+
251
+ 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.
252
+
253
+ 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.
254
+
255
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
256
+
257
+ * Patreon: https://patreon.com/TheBlokeAI
258
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
259
+
260
+ **Special thanks to**: Aemon Algiz.
261
+
262
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
263
+
264
+
265
+ Thank you to all my generous patrons and donaters!
266
+
267
+ And thank you again to a16z for their generous grant.
268
+
269
+ <!-- footer end -->
270
+
271
+ # Original model card: LAION LeoLM's Leo Hessianai 7B
272
+
273
+ # LAION LeoLM: **L**inguistically **E**nhanced **O**pen **L**anguage **M**odel
274
+ Meet LeoLM, the first open and commercially available German Foundation Language Model built on Llama-2.
275
+ Our models extend Llama-2's capabilities into German through continued pretraining on a large corpus of German-language and mostly locality specific text.
276
+ Thanks to a compute grant at HessianAI's new supercomputer **42**, we release two foundation models trained with 8k context length,
277
+ [`LeoLM/leo-hessianai-7b`](https://huggingface.co/LeoLM/leo-hessianai-7b) and [`LeoLM/leo-hessianai-13b`](https://huggingface.co/LeoLM/leo-hessianai-13b) under the [Llama-2 community license](https://huggingface.co/meta-llama/Llama-2-70b/raw/main/LICENSE.txt) (70b also coming soon! 👀).
278
+ With this release, we hope to bring a new wave of opportunities to German open-source and commercial LLM research and accelerate adoption.
279
+ Read our [blog post]() or our paper (preprint coming soon) for more details!
280
+
281
+ *A project by Björn Plüster and Christoph Schuhmann in collaboration with LAION and HessianAI.*
282
+
283
+
284
+ ## Model Details
285
+ - **Finetuned from:** [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf)
286
+ - **Model type:** Causal decoder-only transformer language model
287
+ - **Language:** English and German
288
+ - **License:** [LLAMA 2 COMMUNITY LICENSE AGREEMENT](https://huggingface.co/meta-llama/Llama-2-70b/raw/main/LICENSE.txt)
289
+ - **Contact:** [LAION Discord](https://discord.com/invite/eq3cAMZtCC) or [Björn Plüster](mailto:[email protected])
290
+
291
+
292
+ ## Use in 🤗Transformers
293
+ First install direct dependencies:
294
+ ```
295
+ pip install transformers torch sentencepiece
296
+ ```
297
+ If you want faster inference using flash-attention2, you need to install these dependencies:
298
+ ```bash
299
+ pip install packaging ninja
300
+ pip install flash-attn==v2.1.1 --no-build-isolation
301
+ pip install git+https://github.com/HazyResearch/[email protected]#subdirectory=csrc/rotary
302
+ ```
303
+ Then load the model in transformers:
304
+ ```python
305
+ from transformers import AutoModelForCausalLM, AutoTokenizer
306
+ import torch
307
+
308
+ model = AutoModelForCausalLM.from_pretrained(
309
+ model="LeoLM/leo-hessianai-7b",
310
+ device_map="auto",
311
+ torch_dtype=torch.float16,
312
+ trust_remote_code=True # True for flash-attn2 else False
313
+ )
314
+ ```
315
+
316
+ ## Training parameters
317
+ ![training_parameters](imgs/training_params.png "Training Hyperparameters")
318
+
319
+
320
+ ## Benchmarks
321
+ ![benchmarks](imgs/benchmarks.png "Benchmark Scores")