TheBloke commited on
Commit
bb294d9
1 Parent(s): eb2d104

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +423 -0
README.md ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: LeoLM/leo-hessianai-70b
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 70B
15
+ model_type: llama
16
+ pipeline_tag: text-generation
17
+ prompt_template: '<|im_start|>system
18
+
19
+ {system_message}<|im_end|>
20
+
21
+ <|im_start|>user
22
+
23
+ {prompt}<|im_end|>
24
+
25
+ <|im_start|>assistant
26
+
27
+ '
28
+ quantized_by: TheBloke
29
+ ---
30
+ <!-- markdownlint-disable MD041 -->
31
+
32
+ <!-- header start -->
33
+ <!-- 200823 -->
34
+ <div style="width: auto; margin-left: auto; margin-right: auto">
35
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
36
+ </div>
37
+ <div style="display: flex; justify-content: space-between; width: 100%;">
38
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
39
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
40
+ </div>
41
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
42
+ <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>
43
+ </div>
44
+ </div>
45
+ <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>
46
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
47
+ <!-- header end -->
48
+
49
+ # Leo Hessianai 70B - AWQ
50
+ - Model creator: [LAION LeoLM](https://huggingface.co/LeoLM)
51
+ - Original model: [Leo Hessianai 70B](https://huggingface.co/LeoLM/leo-hessianai-70b)
52
+
53
+ <!-- description start -->
54
+ ## Description
55
+
56
+ This repo contains AWQ model files for [LAION LeoLM's Leo Hessianai 70B](https://huggingface.co/LeoLM/leo-hessianai-70b).
57
+
58
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
59
+
60
+
61
+ ### About AWQ
62
+
63
+ 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 with equivalent or better quality compared to the most commonly used GPTQ settings.
64
+
65
+ AWQ models are currently supported on Linux and Windows, with NVidia GPUs only. macOS users: please use GGUF models instead.
66
+
67
+ It is supported by:
68
+
69
+ - [Text Generation Webui](https://github.com/oobabooga/text-generation-webui) - using Loader: AutoAWQ
70
+ - [vLLM](https://github.com/vllm-project/vllm) - version 0.2.2 or later for support for all model types.
71
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
72
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later, from any code or client that supports Transformers
73
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) - for use from Python code
74
+
75
+ <!-- description end -->
76
+ <!-- repositories-available start -->
77
+ ## Repositories available
78
+
79
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/leo-hessianai-70B-AWQ)
80
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/leo-hessianai-70B-GPTQ)
81
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/leo-hessianai-70B-GGUF)
82
+ * [LAION LeoLM's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/LeoLM/leo-hessianai-70b)
83
+ <!-- repositories-available end -->
84
+
85
+ <!-- prompt-template start -->
86
+ ## Prompt template: ChatML
87
+
88
+ ```
89
+ <|im_start|>system
90
+ {system_message}<|im_end|>
91
+ <|im_start|>user
92
+ {prompt}<|im_end|>
93
+ <|im_start|>assistant
94
+
95
+ ```
96
+
97
+ <!-- prompt-template end -->
98
+
99
+
100
+ <!-- README_AWQ.md-provided-files start -->
101
+ ## Provided files, and AWQ parameters
102
+
103
+ I currently release 128g GEMM models only. The addition of group_size 32 models, and GEMV kernel models, is being actively considered.
104
+
105
+ Models are released as sharded safetensors files.
106
+
107
+ | Branch | Bits | GS | AWQ Dataset | Seq Len | Size |
108
+ | ------ | ---- | -- | ----------- | ------- | ---- |
109
+ | [main](https://huggingface.co/TheBloke/leo-hessianai-70B-AWQ/tree/main) | 4 | 128 | [German Quad](https://huggingface.co/datasets/deepset/germanquad/viewer/) | 8192 | 36.61 GB
110
+
111
+ <!-- README_AWQ.md-provided-files end -->
112
+
113
+ <!-- README_AWQ.md-text-generation-webui start -->
114
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
115
+
116
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
117
+
118
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
119
+
120
+ 1. Click the **Model tab**.
121
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/leo-hessianai-70B-AWQ`.
122
+ 3. Click **Download**.
123
+ 4. The model will start downloading. Once it's finished it will say "Done".
124
+ 5. In the top left, click the refresh icon next to **Model**.
125
+ 6. In the **Model** dropdown, choose the model you just downloaded: `leo-hessianai-70B-AWQ`
126
+ 7. Select **Loader: AutoAWQ**.
127
+ 8. Click Load, and the model will load and is now ready for use.
128
+ 9. 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.
129
+ 10. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
130
+ <!-- README_AWQ.md-text-generation-webui end -->
131
+
132
+ <!-- README_AWQ.md-use-from-vllm start -->
133
+ ## Multi-user inference server: vLLM
134
+
135
+ Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
136
+
137
+ - Please ensure you are using vLLM version 0.2 or later.
138
+ - When using vLLM as a server, pass the `--quantization awq` parameter.
139
+
140
+ For example:
141
+
142
+ ```shell
143
+ python3 -m vllm.entrypoints.api_server --model TheBloke/leo-hessianai-70B-AWQ --quantization awq --dtype auto
144
+ ```
145
+
146
+ - When using vLLM from Python code, again set `quantization=awq`.
147
+
148
+ For example:
149
+
150
+ ```python
151
+ from vllm import LLM, SamplingParams
152
+
153
+ prompts = [
154
+ "Tell me about AI",
155
+ "Write a story about llamas",
156
+ "What is 291 - 150?",
157
+ "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
158
+ ]
159
+ prompt_template=f'''<|im_start|>system
160
+ {system_message}<|im_end|>
161
+ <|im_start|>user
162
+ {prompt}<|im_end|>
163
+ <|im_start|>assistant
164
+ '''
165
+
166
+ prompts = [prompt_template.format(prompt=prompt) for prompt in prompts]
167
+
168
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
169
+
170
+ llm = LLM(model="TheBloke/leo-hessianai-70B-AWQ", quantization="awq", dtype="auto")
171
+
172
+ outputs = llm.generate(prompts, sampling_params)
173
+
174
+ # Print the outputs.
175
+ for output in outputs:
176
+ prompt = output.prompt
177
+ generated_text = output.outputs[0].text
178
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
179
+ ```
180
+ <!-- README_AWQ.md-use-from-vllm start -->
181
+
182
+ <!-- README_AWQ.md-use-from-tgi start -->
183
+ ## Multi-user inference server: Hugging Face Text Generation Inference (TGI)
184
+
185
+ Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
186
+
187
+ Example Docker parameters:
188
+
189
+ ```shell
190
+ --model-id TheBloke/leo-hessianai-70B-AWQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
191
+ ```
192
+
193
+ Example Python code for interfacing with TGI (requires [huggingface-hub](https://github.com/huggingface/huggingface_hub) 0.17.0 or later):
194
+
195
+ ```shell
196
+ pip3 install huggingface-hub
197
+ ```
198
+
199
+ ```python
200
+ from huggingface_hub import InferenceClient
201
+
202
+ endpoint_url = "https://your-endpoint-url-here"
203
+
204
+ prompt = "Tell me about AI"
205
+ prompt_template=f'''<|im_start|>system
206
+ {system_message}<|im_end|>
207
+ <|im_start|>user
208
+ {prompt}<|im_end|>
209
+ <|im_start|>assistant
210
+ '''
211
+
212
+ client = InferenceClient(endpoint_url)
213
+ response = client.text_generation(prompt,
214
+ max_new_tokens=128,
215
+ do_sample=True,
216
+ temperature=0.7,
217
+ top_p=0.95,
218
+ top_k=40,
219
+ repetition_penalty=1.1)
220
+
221
+ print(f"Model output: ", response)
222
+ ```
223
+ <!-- README_AWQ.md-use-from-tgi end -->
224
+
225
+ <!-- README_AWQ.md-use-from-python start -->
226
+ ## Inference from Python code using Transformers
227
+
228
+ ### Install the necessary packages
229
+
230
+ - Requires: [Transformers](https://huggingface.co/docs/transformers) 4.35.0 or later.
231
+ - Requires: [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) 0.1.6 or later.
232
+
233
+ ```shell
234
+ pip3 install --upgrade "autoawq>=0.1.6" "transformers>=4.35.0"
235
+ ```
236
+
237
+ Note that if you are using PyTorch 2.0.1, the above AutoAWQ command will automatically upgrade you to PyTorch 2.1.0.
238
+
239
+ If you are using CUDA 11.8 and wish to continue using PyTorch 2.0.1, instead run this command:
240
+
241
+ ```shell
242
+ pip3 install https://github.com/casper-hansen/AutoAWQ/releases/download/v0.1.6/autoawq-0.1.6+cu118-cp310-cp310-linux_x86_64.whl
243
+ ```
244
+
245
+ If you have problems installing [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) using the pre-built wheels, install it from source instead:
246
+
247
+ ```shell
248
+ pip3 uninstall -y autoawq
249
+ git clone https://github.com/casper-hansen/AutoAWQ
250
+ cd AutoAWQ
251
+ pip3 install .
252
+ ```
253
+
254
+ ### Transformers example code (requires Transformers 4.35.0 and later)
255
+
256
+ ```python
257
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
258
+
259
+ model_name_or_path = "TheBloke/leo-hessianai-70B-AWQ"
260
+
261
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
262
+ model = AutoModelForCausalLM.from_pretrained(
263
+ model_name_or_path,
264
+ low_cpu_mem_usage=True,
265
+ device_map="cuda:0"
266
+ )
267
+
268
+ # Using the text streamer to stream output one token at a time
269
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
270
+
271
+ prompt = "Tell me about AI"
272
+ prompt_template=f'''<|im_start|>system
273
+ {system_message}<|im_end|>
274
+ <|im_start|>user
275
+ {prompt}<|im_end|>
276
+ <|im_start|>assistant
277
+ '''
278
+
279
+ # Convert prompt to tokens
280
+ tokens = tokenizer(
281
+ prompt_template,
282
+ return_tensors='pt'
283
+ ).input_ids.cuda()
284
+
285
+ generation_params = {
286
+ "do_sample": True,
287
+ "temperature": 0.7,
288
+ "top_p": 0.95,
289
+ "top_k": 40,
290
+ "max_new_tokens": 512,
291
+ "repetition_penalty": 1.1
292
+ }
293
+
294
+ # Generate streamed output, visible one token at a time
295
+ generation_output = model.generate(
296
+ tokens,
297
+ streamer=streamer,
298
+ **generation_params
299
+ )
300
+
301
+ # Generation without a streamer, which will include the prompt in the output
302
+ generation_output = model.generate(
303
+ tokens,
304
+ **generation_params
305
+ )
306
+
307
+ # Get the tokens from the output, decode them, print them
308
+ token_output = generation_output[0]
309
+ text_output = tokenizer.decode(token_output)
310
+ print("model.generate output: ", text_output)
311
+
312
+ # Inference is also possible via Transformers' pipeline
313
+ from transformers import pipeline
314
+
315
+ pipe = pipeline(
316
+ "text-generation",
317
+ model=model,
318
+ tokenizer=tokenizer,
319
+ **generation_params
320
+ )
321
+
322
+ pipe_output = pipe(prompt_template)[0]['generated_text']
323
+ print("pipeline output: ", pipe_output)
324
+
325
+ ```
326
+ <!-- README_AWQ.md-use-from-python end -->
327
+
328
+ <!-- README_AWQ.md-compatibility start -->
329
+ ## Compatibility
330
+
331
+ The files provided are tested to work with:
332
+
333
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui) using `Loader: AutoAWQ`.
334
+ - [vLLM](https://github.com/vllm-project/vllm) version 0.2.0 and later.
335
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) version 1.1.0 and later.
336
+ - [Transformers](https://huggingface.co/docs/transformers) version 4.35.0 and later.
337
+ - [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) version 0.1.1 and later.
338
+
339
+ <!-- README_AWQ.md-compatibility end -->
340
+
341
+ <!-- footer start -->
342
+ <!-- 200823 -->
343
+ ## Discord
344
+
345
+ For further support, and discussions on these models and AI in general, join us at:
346
+
347
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
348
+
349
+ ## Thanks, and how to contribute
350
+
351
+ Thanks to the [chirper.ai](https://chirper.ai) team!
352
+
353
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
354
+
355
+ 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.
356
+
357
+ 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.
358
+
359
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
360
+
361
+ * Patreon: https://patreon.com/TheBlokeAI
362
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
363
+
364
+ **Special thanks to**: Aemon Algiz.
365
+
366
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
367
+
368
+
369
+ Thank you to all my generous patrons and donaters!
370
+
371
+ And thank you again to a16z for their generous grant.
372
+
373
+ <!-- footer end -->
374
+
375
+ # Original model card: LAION LeoLM's Leo Hessianai 70B
376
+
377
+ # LAION LeoLM 70b: **L**inguistically **E**nhanced **O**pen **L**anguage **M**odel
378
+ Meet LeoLM, the first open and commercially available German Foundation Language Model built on Llama-2.
379
+ Our models extend Llama-2's capabilities into German through continued pretraining on a large corpus of German-language and mostly locality specific text.
380
+ Thanks to a compute grant at HessianAI's new supercomputer **42**, we release a series foundation models trained with 8k context length
381
+ under the [Llama-2 community license](https://huggingface.co/meta-llama/Llama-2-70b/raw/main/LICENSE.txt). Now, we're finally releasing the
382
+ much anticipated `leo-hessianai-70b`, the largest model of this series based on `Llama-2-70b`.
383
+ With this release, we hope to bring a new wave of opportunities to German open-source and commercial LLM research and accelerate adoption.
384
+ Read our [blog post](https://laion.ai/blog/leo-lm/) or our paper (preprint coming soon) for more details!
385
+
386
+ *A project by Björn Plüster and Christoph Schuhmann in collaboration with LAION and HessianAI.*
387
+
388
+
389
+ ## Model Details
390
+ - **Finetuned from:** [meta-llama/Llama-2-70b-hf](https://huggingface.co/meta-llama/Llama-2-70b-hf)
391
+ - **Model type:** Causal decoder-only transformer language model
392
+ - **Language:** English and German
393
+ - **License:** [LLAMA 2 COMMUNITY LICENSE AGREEMENT](https://huggingface.co/meta-llama/Llama-2-70b/raw/main/LICENSE.txt)
394
+ - **Contact:** [LAION Discord](https://discord.com/invite/eq3cAMZtCC) or [Björn Plüster](mailto:bjoern.pl@outlook.de)
395
+
396
+
397
+ ## Use in 🤗Transformers
398
+ First install direct dependencies:
399
+ ```
400
+ pip install transformers torch
401
+ ```
402
+
403
+ Then load the model in transformers. Note that this requires lots of VRAM and most-likely multiple devices. Use `load_in_8bit=True` or `load_in_4bit=True`
404
+ to save some memory by using a quantized version. For more quantized versions, check out our models at TheBloke's page: (coming soon!)
405
+ ```python
406
+ from transformers import AutoModelForCausalLM, AutoTokenizer
407
+ import torch
408
+
409
+ model = AutoModelForCausalLM.from_pretrained(
410
+ model="LeoLM/leo-hessianai-70b",
411
+ device_map="auto",
412
+ torch_dtype=torch.bfloat16,
413
+ use_flash_attention_2=False # Set to true to use FA2. Requires `pip install flash-attn`
414
+ )
415
+ ```
416
+
417
+ ## Training parameters
418
+ ![training_parameters](imgs/hyperparams.png "Training Hyperparameters")
419
+
420
+
421
+ ## Benchmarks
422
+ ![benchmarks](imgs/benchmarks.png "Benchmark Scores")
423
+ ![benchmarks](imgs/translation_scores.png "Translation Benchmark Scores")