TheBloke commited on
Commit
b2bfade
1 Parent(s): 7fc8cdb

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +552 -0
README.md ADDED
@@ -0,0 +1,552 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: LeoLM/leo-hessianai-13b-chat-bilingual
3
+ datasets:
4
+ - LeoLM/OpenSchnabeltier
5
+ - OpenAssistant/OASST-DE
6
+ - FreedomIntelligence/alpaca-gpt4-deutsch
7
+ - FreedomIntelligence/evol-instruct-deutsch
8
+ - LeoLM/German_Poems
9
+ - LeoLM/German_Songs
10
+ - garage-bAInd/Open-Platypus
11
+ - WizardLM/WizardLM_evol_instruct_70k
12
+ - bjoernp/oasst25-08-23-filtered
13
+ inference: false
14
+ language:
15
+ - en
16
+ - de
17
+ library_name: transformers
18
+ license: llama2
19
+ model_creator: LAION LeoLM
20
+ model_name: Leo Hessianai 13B Chat Bilingual
21
+ model_type: llama
22
+ pipeline_tag: text-generation
23
+ prompt_template: '<|im_start|>system
24
+
25
+ {system_message}<|im_end|>
26
+
27
+ <|im_start|>user
28
+
29
+ {prompt}<|im_end|>
30
+
31
+ <|im_start|>assistant
32
+
33
+ '
34
+ quantized_by: TheBloke
35
+ ---
36
+
37
+ <!-- header start -->
38
+ <!-- 200823 -->
39
+ <div style="width: auto; margin-left: auto; margin-right: auto">
40
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
41
+ </div>
42
+ <div style="display: flex; justify-content: space-between; width: 100%;">
43
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
44
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
45
+ </div>
46
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
47
+ <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>
48
+ </div>
49
+ </div>
50
+ <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>
51
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
52
+ <!-- header end -->
53
+
54
+ # Leo Hessianai 13B Chat Bilingual - GPTQ
55
+ - Model creator: [LAION LeoLM](https://huggingface.co/LeoLM)
56
+ - Original model: [Leo Hessianai 13B Chat Bilingual](https://huggingface.co/LeoLM/leo-hessianai-13b-chat-bilingual)
57
+
58
+ <!-- description start -->
59
+ ## Description
60
+
61
+ This repo contains GPTQ model files for [LAION LeoLM's Leo Hessianai 13B Chat Bilingual](https://huggingface.co/LeoLM/leo-hessianai-13b-chat-bilingual).
62
+
63
+ 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.
64
+
65
+ <!-- description end -->
66
+ <!-- repositories-available start -->
67
+ ## Repositories available
68
+
69
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-AWQ)
70
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ)
71
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GGUF)
72
+ * [LAION LeoLM's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/LeoLM/leo-hessianai-13b-chat-bilingual)
73
+ <!-- repositories-available end -->
74
+
75
+ <!-- prompt-template start -->
76
+ ## Prompt template: ChatML
77
+
78
+ ```
79
+ <|im_start|>system
80
+ {system_message}<|im_end|>
81
+ <|im_start|>user
82
+ {prompt}<|im_end|>
83
+ <|im_start|>assistant
84
+
85
+ ```
86
+
87
+ <!-- prompt-template end -->
88
+
89
+
90
+ <!-- README_GPTQ.md-provided-files start -->
91
+ ## Provided files, and GPTQ parameters
92
+
93
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
94
+
95
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
96
+
97
+ All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the `main` branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
98
+
99
+ <details>
100
+ <summary>Explanation of GPTQ parameters</summary>
101
+
102
+ - Bits: The bit size of the quantised model.
103
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
104
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
105
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
106
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
107
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
108
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
109
+
110
+ </details>
111
+
112
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
113
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
114
+ | [main](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 7.26 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
115
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 8.01 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
116
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 13.36 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
117
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 13.66 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
118
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 14.55 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
119
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 8192 | 7.51 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
120
+
121
+ <!-- README_GPTQ.md-provided-files end -->
122
+
123
+ <!-- README_GPTQ.md-download-from-branches start -->
124
+ ## How to download, including from branches
125
+
126
+ ### In text-generation-webui
127
+
128
+ To download from the `main` branch, enter `TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ` in the "Download model" box.
129
+
130
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ:gptq-4bit-32g-actorder_True`
131
+
132
+ ### From the command line
133
+
134
+ I recommend using the `huggingface-hub` Python library:
135
+
136
+ ```shell
137
+ pip3 install huggingface-hub
138
+ ```
139
+
140
+ To download the `main` branch to a folder called `leo-hessianai-13B-chat-bilingual-GPTQ`:
141
+
142
+ ```shell
143
+ mkdir leo-hessianai-13B-chat-bilingual-GPTQ
144
+ huggingface-cli download TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ --local-dir leo-hessianai-13B-chat-bilingual-GPTQ --local-dir-use-symlinks False
145
+ ```
146
+
147
+ To download from a different branch, add the `--revision` parameter:
148
+
149
+ ```shell
150
+ mkdir leo-hessianai-13B-chat-bilingual-GPTQ
151
+ huggingface-cli download TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir leo-hessianai-13B-chat-bilingual-GPTQ --local-dir-use-symlinks False
152
+ ```
153
+
154
+ <details>
155
+ <summary>More advanced huggingface-cli download usage</summary>
156
+
157
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Huggingface cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
158
+
159
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
160
+
161
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
162
+
163
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
164
+
165
+ ```shell
166
+ pip3 install hf_transfer
167
+ ```
168
+
169
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
170
+
171
+ ```shell
172
+ mkdir leo-hessianai-13B-chat-bilingual-GPTQ
173
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ --local-dir leo-hessianai-13B-chat-bilingual-GPTQ --local-dir-use-symlinks False
174
+ ```
175
+
176
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
177
+ </details>
178
+
179
+ ### With `git` (**not** recommended)
180
+
181
+ To clone a specific branch with `git`, use a command like this:
182
+
183
+ ```shell
184
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ
185
+ ```
186
+
187
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
188
+
189
+ <!-- README_GPTQ.md-download-from-branches end -->
190
+ <!-- README_GPTQ.md-text-generation-webui start -->
191
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
192
+
193
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
194
+
195
+ 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.
196
+
197
+ 1. Click the **Model tab**.
198
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ`.
199
+ - To download from a specific branch, enter for example `TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ:gptq-4bit-32g-actorder_True`
200
+ - see Provided Files above for the list of branches for each option.
201
+ 3. Click **Download**.
202
+ 4. The model will start downloading. Once it's finished it will say "Done".
203
+ 5. In the top left, click the refresh icon next to **Model**.
204
+ 6. In the **Model** dropdown, choose the model you just downloaded: `leo-hessianai-13B-chat-bilingual-GPTQ`
205
+ 7. The model will automatically load, and is now ready for use!
206
+ 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.
207
+ * Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
208
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
209
+ <!-- README_GPTQ.md-text-generation-webui end -->
210
+
211
+ <!-- README_GPTQ.md-use-from-python start -->
212
+ ## How to use this GPTQ model from Python code
213
+
214
+ ### Install the necessary packages
215
+
216
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
217
+
218
+ ```shell
219
+ pip3 install transformers optimum
220
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
221
+ ```
222
+
223
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
224
+
225
+ ```shell
226
+ pip3 uninstall -y auto-gptq
227
+ git clone https://github.com/PanQiWei/AutoGPTQ
228
+ cd AutoGPTQ
229
+ git checkout v0.4.2
230
+ pip3 install .
231
+ ```
232
+
233
+ ### You can then use the following code
234
+
235
+ ```python
236
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
237
+
238
+ model_name_or_path = "TheBloke/leo-hessianai-13B-chat-bilingual-GPTQ"
239
+ # To use a different branch, change revision
240
+ # For example: revision="gptq-4bit-32g-actorder_True"
241
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
242
+ device_map="auto",
243
+ trust_remote_code=False,
244
+ revision="main")
245
+
246
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
247
+
248
+ prompt = "Tell me about AI"
249
+ prompt_template=f'''<|im_start|>system
250
+ {system_message}<|im_end|>
251
+ <|im_start|>user
252
+ {prompt}<|im_end|>
253
+ <|im_start|>assistant
254
+ '''
255
+
256
+ print("\n\n*** Generate:")
257
+
258
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
259
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
260
+ print(tokenizer.decode(output[0]))
261
+
262
+ # Inference can also be done using transformers' pipeline
263
+
264
+ print("*** Pipeline:")
265
+ pipe = pipeline(
266
+ "text-generation",
267
+ model=model,
268
+ tokenizer=tokenizer,
269
+ max_new_tokens=512,
270
+ do_sample=True,
271
+ temperature=0.7,
272
+ top_p=0.95,
273
+ top_k=40,
274
+ repetition_penalty=1.1
275
+ )
276
+
277
+ print(pipe(prompt_template)[0]['generated_text'])
278
+ ```
279
+ <!-- README_GPTQ.md-use-from-python end -->
280
+
281
+ <!-- README_GPTQ.md-compatibility start -->
282
+ ## Compatibility
283
+
284
+ The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
285
+
286
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
287
+
288
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
289
+ <!-- README_GPTQ.md-compatibility end -->
290
+
291
+ <!-- footer start -->
292
+ <!-- 200823 -->
293
+ ## Discord
294
+
295
+ For further support, and discussions on these models and AI in general, join us at:
296
+
297
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
298
+
299
+ ## Thanks, and how to contribute
300
+
301
+ Thanks to the [chirper.ai](https://chirper.ai) team!
302
+
303
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
304
+
305
+ 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.
306
+
307
+ 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.
308
+
309
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
310
+
311
+ * Patreon: https://patreon.com/TheBlokeAI
312
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
313
+
314
+ **Special thanks to**: Aemon Algiz.
315
+
316
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
317
+
318
+
319
+ Thank you to all my generous patrons and donaters!
320
+
321
+ And thank you again to a16z for their generous grant.
322
+
323
+ <!-- footer end -->
324
+
325
+ # Original model card: LAION LeoLM's Leo Hessianai 13B Chat Bilingual
326
+
327
+ # LAION LeoLM: **L**inguistically **E**nhanced **O**pen **L**anguage **M**odel
328
+ Meet LeoLM, the first open and commercially available German Foundation Language Model built on Llama-2.
329
+ Our models extend Llama-2's capabilities into German through continued pretraining on a large corpus of German-language and mostly locality specific text.
330
+ Thanks to a compute grant at HessianAI's new supercomputer **42**, we release two foundation models trained with 8k context length,
331
+ [`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! 👀).
332
+ With this release, we hope to bring a new wave of opportunities to German open-source and commercial LLM research and accelerate adoption.
333
+ Read our [blog post]() or our paper (preprint coming soon) for more details!
334
+
335
+ *A project by Björn Plüster and Christoph Schuhmann in collaboration with LAION and HessianAI.*
336
+
337
+ ## LeoLM Chat
338
+ `LeoLM/leo-hessianai-13b-chat-bilingual` is a bilingual English-German chat model built on our foundation model `LeoLM/leo-hessianai-13b` and finetuned on a selection of German translateed instruction datasets and their English counterparts.
339
+ The model performs exceptionally well on writing, explanation and discussion tasks but struggles somewhat with math and advanced reasoning. See our MT-Bench scores:
340
+ ```
341
+ {
342
+ "first_turn": 6.13125,
343
+ "second_turn": 4.88125,
344
+ "categories": {
345
+ "writing": 6.75,
346
+ "roleplay": 5.55,
347
+ "reasoning": 3.3,
348
+ "math": 2.25,
349
+ "coding": 3.9,
350
+ "extraction": 5.8,
351
+ "stem": 7.55,
352
+ "humanities": 8.95
353
+ },
354
+ "average": 5.50625
355
+ }
356
+ ```
357
+
358
+ ## Model Details
359
+
360
+ - **Finetuned from:** [LeoLM/leo-hessianai-13b](https://huggingface.co/LeoLM/leo-hessianai-13b)
361
+ - **Model type:** Causal decoder-only transformer language model
362
+ - **Language:** English and German
363
+ - **Demo:** [Web Demo]()
364
+ - **License:** [LLAMA 2 COMMUNITY LICENSE AGREEMENT](https://huggingface.co/meta-llama/Llama-2-70b/raw/main/LICENSE.txt)
365
+ - **Contact:** [LAION Discord](https://discord.com/invite/eq3cAMZtCC) or [Björn Plüster](mailto:bjoern.pl@outlook.de)
366
+
367
+
368
+ ## Use in 🤗Transformers
369
+ First install direct dependencies:
370
+ ```
371
+ pip install transformers torch sentencepiece
372
+ ```
373
+ If you want faster inference using flash-attention2, you need to install these dependencies:
374
+ ```bash
375
+ pip install packaging ninja
376
+ pip install flash-attn==v2.1.1 --no-build-isolation
377
+ pip install git+https://github.com/HazyResearch/flash-attention.git@v2.1.1#subdirectory=csrc/rotary
378
+ ```
379
+ Then load the model in transformers:
380
+ ```python
381
+ from transformers import pipeline
382
+ import torch
383
+
384
+ system_prompt = """<|im_start|>system
385
+ Dies ist eine Unterhaltung zwischen einem intelligenten, hilfsbereitem KI-Assistenten und einem Nutzer.
386
+ Der Assistent gibt ausführliche, hilfreiche und ehrliche Antworten.<|im_end|>
387
+
388
+ """
389
+ prompt_format = "<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
390
+ prompt = "Erkläre mir wie die Fahrradwegesituation in Hamburg ist."
391
+
392
+ generator = pipeline(model="LeoLM/leo-hessianai-13b-chat-bilingual", device="cuda", torch_dtype=torch.float16, trust_remote_code=True) # True for flash-attn2 else False
393
+ print(generator(prompt_format.format(prompt=prompt), do_sample=True, top_p=0.95, max_length=8192))
394
+ ```
395
+
396
+ "*Als KI kann ich keine persönlichen Beobachtungen teilen, aber ich kann einige allgemeine Informationen zur Fahrradwegesituation in Hamburg liefern. Im Vergleich zu vielen anderen großen Städten hat Hamburg eine hohe Anzahl von Fahrradfahrern und nimmt seine Verantwortung für nachhaltige Verkehrsmittel sehr ernst. Es gibt viele Fahrradwege und separate Fahrspuren, die Radfahrern ermöglichen, zusammen mit dem Autoverkehr zu fahren. Diese Fahrradspuren sind oft mit Markierungen gekennzeichnet und durch physische Trennungen von anderen Fahrspuren abgegrenzt. Darüber hinaus gibt es viele Fahrradstraßen, auf denen Radfahrer Vorfahrt haben und Autos langsamer fahren müssen.*
397
+
398
+ *In einigen städtischen Gebieten können Fahrradwege jedoch eng oder überfüllt sein, besonders während der Stoßzeiten. Es gibt auch viele Kreuzungen, an denen Radfahrer anhalten und auf Grün warten müssen, ähnlich wie Autofahrer. Insgesamt ist die Fahrradinfrastruktur in Hamburg ziemlich gut, aber wie überall gibt es immer Raum für Verbesserungen.*"
399
+
400
+ ## Prompting / Prompt Template
401
+
402
+ Prompt dialogue template (ChatML format):
403
+
404
+ ```
405
+ """
406
+ <|im_start|>system
407
+ {system_message}<|im_end|>
408
+ <|im_start|>user
409
+ {prompt}<|im_end|>
410
+ <|im_start|>assistant
411
+ """
412
+ ```
413
+
414
+ The model input can contain multiple conversation turns between user and assistant, e.g.
415
+ ```
416
+ <|im_start|>user
417
+ {prompt 1}<|im_end|>
418
+ <|im_start|>assistant
419
+ {reply 1}<|im_end|>
420
+ <|im_start|>user
421
+ {prompt 2}<|im_end|>
422
+ <|im_start|>assistant
423
+ (...)
424
+ ```
425
+
426
+ ## Ethical Considerations and Limitations
427
+
428
+ LeoLM has been tested in English and German, and has not covered, nor could it cover all scenarios.
429
+ For these reasons, as with all LLMs, the potential outputs of `LeoLM/leo-hessianai-7b-chat` cannot be predicted
430
+ in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses
431
+ to user prompts. Therefore, before deploying any applications of `LeoLM/leo-hessianai-7b-chat`, developers should
432
+ perform safety testing and tuning tailored to their specific applications of the model.
433
+
434
+ Please see Meta's [Responsible Use Guide](https://ai.meta.com/llama/responsible-use-guide/).
435
+
436
+ ## Finetuning Details
437
+
438
+ | Hyperparameter | Value |
439
+ |---|---|
440
+ | Num epochs | 3 |
441
+ | Examples per epoch | 233275 |
442
+ | Global batch size | 256 |
443
+ | Learning rate | 3e-5 |
444
+ | Warmup steps | 100 |
445
+ | LR scheduler | Cosine |
446
+ | Adam betas | (0.9, 0.95) |
447
+ | Weight decay | 0.001 |
448
+
449
+
450
+ ## Dataset Details
451
+ ```
452
+ ## Stats for 'Subset of LeoLM/OpenSchnabeltier' (21314 samples (100.0%))
453
+ -----------------
454
+ Accepted: 21314/21314 (100.0%)
455
+ Accepted tokens: 8134690
456
+ Skipped: 0 (0.0%)
457
+ Min tokens per sample: 25
458
+ Max tokens per sample: 1202
459
+ Avg tokens per sample: 381.65947264708643
460
+ -----------------
461
+
462
+ ## Stats for 'Subset of garage-bAInd/Open-Platypus' (24427 samples (100.0%))
463
+ -----------------
464
+ Accepted: 24427/24427 (100.0%)
465
+ Accepted tokens: 9549043
466
+ Skipped: 0 (0.0%)
467
+ Min tokens per sample: 23
468
+ Max tokens per sample: 5054
469
+ Avg tokens per sample: 390.9216440823679
470
+ -----------------
471
+
472
+ ## Stats for 'Subset of WizardLM/WizardLM_evol_instruct_70k' (68600 samples (100.0%))
473
+ -----------------
474
+ Accepted: 68600/68600 (100.0%)
475
+ Accepted tokens: 33045040
476
+ Skipped: 0 (0.0%)
477
+ Min tokens per sample: 18
478
+ Max tokens per sample: 11810
479
+ Avg tokens per sample: 481.7061224489796
480
+ -----------------
481
+
482
+ ## Stats for 'Subset of FreedomIntelligence/evol-instruct-deutsch' (57841 samples (100.0%))
483
+ -----------------
484
+ Accepted: 57841/57841 (100.0%)
485
+ Accepted tokens: 42958192
486
+ Skipped: 0 (0.0%)
487
+ Min tokens per sample: 33
488
+ Max tokens per sample: 5507
489
+ Avg tokens per sample: 742.6944900675991
490
+ -----------------
491
+
492
+ ## Stats for 'Subset of FreedomIntelligence/alpaca-gpt4-deutsch' (48969 samples (100.0%))
493
+ -----------------
494
+ Accepted: 48969/48969 (100.0%)
495
+ Accepted tokens: 13372005
496
+ Skipped: 0 (0.0%)
497
+ Min tokens per sample: 19
498
+ Max tokens per sample: 1359
499
+ Avg tokens per sample: 273.07082031489307
500
+ -----------------
501
+
502
+ ## Stats for 'Subset of LeoLM/German_Songs' (490 samples (100.0%))
503
+ -----------------
504
+ Accepted: 490/490 (100.0%)
505
+ Accepted tokens: 618642
506
+ Skipped: 0 (0.0%)
507
+ Min tokens per sample: 747
508
+ Max tokens per sample: 1678
509
+ Avg tokens per sample: 1262.534693877551
510
+ -----------------
511
+
512
+
513
+ ## Stats for 'Subset of LeoLM/German_Poems' (392 samples (100.0%))
514
+ -----------------
515
+ Accepted: 392/392 (100.0%)
516
+ Accepted tokens: 187897
517
+ Skipped: 0 (0.0%)
518
+ Min tokens per sample: 231
519
+ Max tokens per sample: 826
520
+ Avg tokens per sample: 479.3290816326531
521
+ -----------------
522
+
523
+ ## Stats for 'Subset of OpenAssistant/OASST_DE' (3646 samples (100.0%))
524
+ -----------------
525
+ Accepted: 3646/3646 (100.0%)
526
+ Accepted tokens: 2338738
527
+ Skipped: 0 (0.0%)
528
+ Min tokens per sample: 29
529
+ Max tokens per sample: 2484
530
+ Avg tokens per sample: 641.4530992868897
531
+ -----------------
532
+
533
+ ## Stats for 'Subset of bjoernp/oasst25-08-23-filtered' (8922 samples (100.0%))
534
+ -----------------
535
+ Accepted: 8922/8922 (100.0%)
536
+ Accepted tokens: 4526427
537
+ Skipped: 0 (0.0%)
538
+ Min tokens per sample: 23
539
+ Max tokens per sample: 5407
540
+ Avg tokens per sample: 507.3332212508406
541
+ -----------------
542
+
543
+ ## Stats for 'total' (235632 samples (100.0%))
544
+ -----------------
545
+ Accepted: 235632/235632 (100.0%)
546
+ Accepted tokens: 115862397
547
+ Skipped: 0 (0.0%)
548
+ Min tokens per sample: 18
549
+ Max tokens per sample: 11810
550
+ Avg tokens per sample: 491.70909299246284
551
+ -----------------
552
+ ```