TheBloke commited on
Commit
151fd32
1 Parent(s): fece006

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +564 -0
README.md ADDED
@@ -0,0 +1,564 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: LeoLM/leo-mistral-hessianai-7b-chat
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
+ inference: false
11
+ language:
12
+ - en
13
+ - de
14
+ library_name: transformers
15
+ license: apache-2.0
16
+ model_creator: LAION LeoLM
17
+ model_name: Leo Mistral Hessianai 7B Chat
18
+ model_type: mistral
19
+ pipeline_tag: text-generation
20
+ prompt_template: '<|im_start|>system
21
+
22
+ {system_message}<|im_end|>
23
+
24
+ <|im_start|>user
25
+
26
+ {prompt}<|im_end|>
27
+
28
+ <|im_start|>assistant
29
+
30
+ '
31
+ quantized_by: TheBloke
32
+ ---
33
+ <!-- markdownlint-disable MD041 -->
34
+
35
+ <!-- header start -->
36
+ <!-- 200823 -->
37
+ <div style="width: auto; margin-left: auto; margin-right: auto">
38
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
39
+ </div>
40
+ <div style="display: flex; justify-content: space-between; width: 100%;">
41
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
42
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
43
+ </div>
44
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
45
+ <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>
46
+ </div>
47
+ </div>
48
+ <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>
49
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
50
+ <!-- header end -->
51
+
52
+ # Leo Mistral Hessianai 7B Chat - GPTQ
53
+ - Model creator: [LAION LeoLM](https://huggingface.co/LeoLM)
54
+ - Original model: [Leo Mistral Hessianai 7B Chat](https://huggingface.co/LeoLM/leo-mistral-hessianai-7b-chat)
55
+
56
+ <!-- description start -->
57
+ ## Description
58
+
59
+ This repo contains GPTQ model files for [LAION LeoLM's Leo Mistral Hessianai 7B Chat](https://huggingface.co/LeoLM/leo-mistral-hessianai-7b-chat).
60
+
61
+ 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.
62
+
63
+ <!-- description end -->
64
+ <!-- repositories-available start -->
65
+ ## Repositories available
66
+
67
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-AWQ)
68
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ)
69
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GGUF)
70
+ * [LAION LeoLM's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/LeoLM/leo-mistral-hessianai-7b-chat)
71
+ <!-- repositories-available end -->
72
+
73
+ <!-- prompt-template start -->
74
+ ## Prompt template: ChatML
75
+
76
+ ```
77
+ <|im_start|>system
78
+ {system_message}<|im_end|>
79
+ <|im_start|>user
80
+ {prompt}<|im_end|>
81
+ <|im_start|>assistant
82
+
83
+ ```
84
+
85
+ <!-- prompt-template end -->
86
+
87
+
88
+ <!-- README_GPTQ.md-provided-files start -->
89
+ ## Provided files, and GPTQ parameters
90
+
91
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
92
+
93
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
94
+
95
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
96
+
97
+ <details>
98
+ <summary>Explanation of GPTQ parameters</summary>
99
+
100
+ - Bits: The bit size of the quantised model.
101
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
102
+ - 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.
103
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
104
+ - 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).
105
+ - 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.
106
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
107
+
108
+ </details>
109
+
110
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
111
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
112
+ | [main](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 4096 | 4.16 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
113
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 4096 | 4.57 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
114
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 4096 | 7.52 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
115
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 4096 | 7.68 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
116
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 4096 | 8.17 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
117
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [German Quad](https://huggingface.co/datasets/deepset/germanquad) | 4096 | 4.30 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
118
+
119
+ <!-- README_GPTQ.md-provided-files end -->
120
+
121
+ <!-- README_GPTQ.md-download-from-branches start -->
122
+ ## How to download, including from branches
123
+
124
+ ### In text-generation-webui
125
+
126
+ To download from the `main` branch, enter `TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ` in the "Download model" box.
127
+
128
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ:gptq-4bit-32g-actorder_True`
129
+
130
+ ### From the command line
131
+
132
+ I recommend using the `huggingface-hub` Python library:
133
+
134
+ ```shell
135
+ pip3 install huggingface-hub
136
+ ```
137
+
138
+ To download the `main` branch to a folder called `Leo-Mistral-Hessianai-7B-Chat-GPTQ`:
139
+
140
+ ```shell
141
+ mkdir Leo-Mistral-Hessianai-7B-Chat-GPTQ
142
+ huggingface-cli download TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ --local-dir Leo-Mistral-Hessianai-7B-Chat-GPTQ --local-dir-use-symlinks False
143
+ ```
144
+
145
+ To download from a different branch, add the `--revision` parameter:
146
+
147
+ ```shell
148
+ mkdir Leo-Mistral-Hessianai-7B-Chat-GPTQ
149
+ huggingface-cli download TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir Leo-Mistral-Hessianai-7B-Chat-GPTQ --local-dir-use-symlinks False
150
+ ```
151
+
152
+ <details>
153
+ <summary>More advanced huggingface-cli download usage</summary>
154
+
155
+ 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.
156
+
157
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
158
+
159
+ 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).
160
+
161
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
162
+
163
+ ```shell
164
+ pip3 install hf_transfer
165
+ ```
166
+
167
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
168
+
169
+ ```shell
170
+ mkdir Leo-Mistral-Hessianai-7B-Chat-GPTQ
171
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ --local-dir Leo-Mistral-Hessianai-7B-Chat-GPTQ --local-dir-use-symlinks False
172
+ ```
173
+
174
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
175
+ </details>
176
+
177
+ ### With `git` (**not** recommended)
178
+
179
+ To clone a specific branch with `git`, use a command like this:
180
+
181
+ ```shell
182
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ
183
+ ```
184
+
185
+ 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.)
186
+
187
+ <!-- README_GPTQ.md-download-from-branches end -->
188
+ <!-- README_GPTQ.md-text-generation-webui start -->
189
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
190
+
191
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
192
+
193
+ 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.
194
+
195
+ 1. Click the **Model tab**.
196
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ`.
197
+
198
+ - To download from a specific branch, enter for example `TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ:gptq-4bit-32g-actorder_True`
199
+ - see Provided Files above for the list of branches for each option.
200
+
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-Mistral-Hessianai-7B-Chat-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
+
208
+ - 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`.
209
+
210
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
211
+
212
+ <!-- README_GPTQ.md-text-generation-webui end -->
213
+
214
+ <!-- README_GPTQ.md-use-from-tgi start -->
215
+ ## Serving this model from Text Generation Inference (TGI)
216
+
217
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
218
+
219
+ Example Docker parameters:
220
+
221
+ ```shell
222
+ --model-id TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
223
+ ```
224
+
225
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
226
+
227
+ ```shell
228
+ pip3 install huggingface-hub
229
+ ```
230
+
231
+ ```python
232
+ from huggingface_hub import InferenceClient
233
+
234
+ endpoint_url = "https://your-endpoint-url-here"
235
+
236
+ prompt = "Tell me about AI"
237
+ prompt_template=f'''<|im_start|>system
238
+ {system_message}<|im_end|>
239
+ <|im_start|>user
240
+ {prompt}<|im_end|>
241
+ <|im_start|>assistant
242
+ '''
243
+
244
+ client = InferenceClient(endpoint_url)
245
+ response = client.text_generation(prompt,
246
+ max_new_tokens=128,
247
+ do_sample=True,
248
+ temperature=0.7,
249
+ top_p=0.95,
250
+ top_k=40,
251
+ repetition_penalty=1.1)
252
+
253
+ print(f"Model output: {response}")
254
+ ```
255
+ <!-- README_GPTQ.md-use-from-tgi end -->
256
+ <!-- README_GPTQ.md-use-from-python start -->
257
+ ## How to use this GPTQ model from Python code
258
+
259
+ ### Install the necessary packages
260
+
261
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
262
+
263
+ ```shell
264
+ pip3 install transformers optimum
265
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
266
+ ```
267
+
268
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
269
+
270
+ ```shell
271
+ pip3 uninstall -y auto-gptq
272
+ git clone https://github.com/PanQiWei/AutoGPTQ
273
+ cd AutoGPTQ
274
+ git checkout v0.4.2
275
+ pip3 install .
276
+ ```
277
+
278
+ ### You can then use the following code
279
+
280
+ ```python
281
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
282
+
283
+ model_name_or_path = "TheBloke/Leo-Mistral-Hessianai-7B-Chat-GPTQ"
284
+ # To use a different branch, change revision
285
+ # For example: revision="gptq-4bit-32g-actorder_True"
286
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
287
+ device_map="auto",
288
+ trust_remote_code=False,
289
+ revision="main")
290
+
291
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
292
+
293
+ prompt = "Tell me about AI"
294
+ prompt_template=f'''<|im_start|>system
295
+ {system_message}<|im_end|>
296
+ <|im_start|>user
297
+ {prompt}<|im_end|>
298
+ <|im_start|>assistant
299
+ '''
300
+
301
+ print("\n\n*** Generate:")
302
+
303
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
304
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
305
+ print(tokenizer.decode(output[0]))
306
+
307
+ # Inference can also be done using transformers' pipeline
308
+
309
+ print("*** Pipeline:")
310
+ pipe = pipeline(
311
+ "text-generation",
312
+ model=model,
313
+ tokenizer=tokenizer,
314
+ max_new_tokens=512,
315
+ do_sample=True,
316
+ temperature=0.7,
317
+ top_p=0.95,
318
+ top_k=40,
319
+ repetition_penalty=1.1
320
+ )
321
+
322
+ print(pipe(prompt_template)[0]['generated_text'])
323
+ ```
324
+ <!-- README_GPTQ.md-use-from-python end -->
325
+
326
+ <!-- README_GPTQ.md-compatibility start -->
327
+ ## Compatibility
328
+
329
+ 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).
330
+
331
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
332
+
333
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
334
+ <!-- README_GPTQ.md-compatibility end -->
335
+
336
+ <!-- footer start -->
337
+ <!-- 200823 -->
338
+ ## Discord
339
+
340
+ For further support, and discussions on these models and AI in general, join us at:
341
+
342
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
343
+
344
+ ## Thanks, and how to contribute
345
+
346
+ Thanks to the [chirper.ai](https://chirper.ai) team!
347
+
348
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
349
+
350
+ 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.
351
+
352
+ 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.
353
+
354
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
355
+
356
+ * Patreon: https://patreon.com/TheBlokeAI
357
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
358
+
359
+ **Special thanks to**: Aemon Algiz.
360
+
361
+ **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
362
+
363
+
364
+ Thank you to all my generous patrons and donaters!
365
+
366
+ And thank you again to a16z for their generous grant.
367
+
368
+ <!-- footer end -->
369
+
370
+ # Original model card: LAION LeoLM's Leo Mistral Hessianai 7B Chat
371
+
372
+ # LAION LeoLM: **L**inguistically **E**nhanced **O**pen **L**anguage **M**odel
373
+ Meet LeoLM, the first open and commercially available German Foundation Language Model built on Llama-2 and Mistral.
374
+ Our models extend Llama-2's capabilities into German through continued pretraining on a large corpus of German-language and mostly locality specific text.
375
+ Thanks to a compute grant at HessianAI's new supercomputer **42**, we release three foundation models trained with 8k context length.
376
+ [`LeoLM/leo-mistral-hessianai-7b`](https://huggingface.co/LeoLM/leo-mistral-hessianai-7b) under Apache 2.0 and [`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! 👀).
377
+ With this release, we hope to bring a new wave of opportunities to German open-source and commercial LLM research and accelerate adoption.
378
+ Read our [blog post](https://laion.ai/blog/leo-lm/) or our paper (preprint coming soon) for more details!
379
+
380
+ *A project by Björn Plüster and Christoph Schuhmann in collaboration with LAION and HessianAI.*
381
+
382
+ ## LeoLM Chat
383
+ `LeoLM/leo-mistral-hessianai-7b-chat` is a German chat model built on our foundation model `LeoLM/leo-mistral-hessianai-7b` and finetuned on a selection of German instruction datasets.
384
+ The model performs exceptionally well on writing, explanation and discussion tasks but struggles somewhat with math and advanced reasoning. See our MT-Bench-DE scores:
385
+ ```
386
+ {
387
+ "first_turn": 6.1,
388
+ "second_turn": 4.7,
389
+ "categories": {
390
+ "writing": 6.8,
391
+ "roleplay": 6.35,
392
+ "reasoning": 3.3,
393
+ "math": 2.75,
394
+ "coding": 4.4,
395
+ "extraction": 4.5,
396
+ "stem": 6.85,
397
+ "humanities": 8.25
398
+ },
399
+ "average": 5.4
400
+ }
401
+ ```
402
+
403
+ ## Model Details
404
+
405
+ - **Finetuned from:** [LeoLM/leo-mistral-hessianai-7b](https://huggingface.co/LeoLM/leo-hessianai-7b)
406
+ - **Model type:** Causal decoder-only transformer language model
407
+ - **Language:** English and German
408
+ - **Demo:** [Web Demo coming soon !]()
409
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
410
+ - **Contact:** [LAION Discord](https://discord.com/invite/eq3cAMZtCC) or [Björn Plüster](mailto:[email protected])
411
+
412
+
413
+ ## Use in 🤗Transformers
414
+ First install direct dependencies:
415
+ ```
416
+ pip install transformers torch sentencepiece
417
+ ```
418
+ If you want faster inference using flash-attention2, you need to install these dependencies:
419
+ ```bash
420
+ pip install packaging ninja
421
+ pip install flash-attn
422
+ ```
423
+ Then load the model in transformers:
424
+ ```python
425
+ from transformers import pipeline
426
+ import torch
427
+
428
+ system_prompt = """<|im_start|>system
429
+ Dies ist eine Unterhaltung zwischen einem intelligenten, hilfsbereitem KI-Assistenten und einem Nutzer.
430
+ Der Assistent gibt ausführliche, hilfreiche und ehrliche Antworten.<|im_end|>
431
+
432
+ """
433
+ prompt_format = "<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
434
+ prompt = "Erkläre mir wie die Fahrradwegesituation in Hamburg ist."
435
+
436
+ generator = pipeline(model="LeoLM/leo-mistral-hessianai-7b-chat", device="cuda", torch_dtype=torch.float16, use_flash_attention_2=True) # True for flash-attn2 else False
437
+ print(generator(prompt_format.format(prompt=prompt), do_sample=True, top_p=0.95, max_length=8192))
438
+ ```
439
+
440
+ "*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.*
441
+
442
+ *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.*"
443
+
444
+ ## Prompting / Prompt Template
445
+
446
+ Prompt dialogue template (ChatML format):
447
+
448
+ ```
449
+ """
450
+ <|im_start|>system
451
+ {system_message}<|im_end|>
452
+ <|im_start|>user
453
+ {prompt}<|im_end|>
454
+ <|im_start|>assistant
455
+ """
456
+ ```
457
+
458
+ The model input can contain multiple conversation turns between user and assistant, e.g.
459
+ ```
460
+ <|im_start|>user
461
+ {prompt 1}<|im_end|>
462
+ <|im_start|>assistant
463
+ {reply 1}<|im_end|>
464
+ <|im_start|>user
465
+ {prompt 2}<|im_end|>
466
+ <|im_start|>assistant
467
+ (...)
468
+ ```
469
+
470
+ ## Ethical Considerations and Limitations
471
+
472
+ LeoLM has been tested in English and German, and has not covered, nor could it cover all scenarios.
473
+ For these reasons, as with all LLMs, the potential outputs of `LeoLM/leo-mistral-hessianai-7b-chat` cannot be predicted
474
+ in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses
475
+ to user prompts. Therefore, before deploying any applications of `LeoLM/leo-mistral-hessianai-7b-chat`, developers should
476
+ perform safety testing and tuning tailored to their specific applications of the model.
477
+
478
+ Please see Meta's [Responsible Use Guide](https://ai.meta.com/llama/responsible-use-guide/).
479
+
480
+ ## Finetuning Details
481
+
482
+ | Hyperparameter | Value |
483
+ |---|---|
484
+ | Num epochs | 4 |
485
+ | Examples per epoch | 131214 |
486
+ | Global batch size | 256 |
487
+ | Learning rate | 1e-5 |
488
+ | Warmup steps | 100 |
489
+ | LR scheduler | Cosine |
490
+ | Adam betas | (0.9, 0.95) |
491
+
492
+
493
+ ## Dataset Details
494
+ ```
495
+ ## Stats for 'Subset of OpenAssistant/OASST-DE' (3534 samples (100.0%))
496
+ -----------------
497
+ Accepted: 3534/3534 (100.0%)
498
+ Accepted tokens: 2259302
499
+ Skipped: 0 (0.0%)
500
+ Min tokens per sample: 29
501
+ Max tokens per sample: 2484
502
+ Avg tokens per sample: 639.3044708545557
503
+ -----------------
504
+
505
+ ## Stats for 'Subset of FreedomIntelligence/evol-instruct-deutsch' (57841 samples (100.0%))
506
+ -----------------
507
+ Accepted: 57841/57841 (100.0%)
508
+ Accepted tokens: 42958192
509
+ Skipped: 0 (0.0%)
510
+ Min tokens per sample: 33
511
+ Max tokens per sample: 5507
512
+ Avg tokens per sample: 742.6944900675991
513
+ -----------------
514
+
515
+ ## Stats for 'Subset of FreedomIntelligence/alpaca-gpt4-deutsch' (48969 samples (100.0%))
516
+ -----------------
517
+ Accepted: 48969/48969 (100.0%)
518
+ Accepted tokens: 13372005
519
+ Skipped: 0 (0.0%)
520
+ Min tokens per sample: 19
521
+ Max tokens per sample: 1359
522
+ Avg tokens per sample: 273.07082031489307
523
+ -----------------
524
+
525
+ ## Stats for 'Subset of LeoLM/OpenSchnabeltier' (21314 samples (100.0%))
526
+ -----------------
527
+ Accepted: 21314/21314 (100.0%)
528
+ Accepted tokens: 8134690
529
+ Skipped: 0 (0.0%)
530
+ Min tokens per sample: 25
531
+ Max tokens per sample: 1202
532
+ Avg tokens per sample: 381.65947264708643
533
+ -----------------
534
+
535
+ ## Stats for 'Subset of LeoLM/German_Poems' (490 samples (100.0%))
536
+ -----------------
537
+ Accepted: 490/490 (100.0%)
538
+ Accepted tokens: 618642
539
+ Skipped: 0 (0.0%)
540
+ Min tokens per sample: 747
541
+ Max tokens per sample: 1678
542
+ Avg tokens per sample: 1262.534693877551
543
+ -----------------
544
+
545
+ ## Stats for 'Subset of LeoLM/German_Songs' (392 samples (100.0%))
546
+ -----------------
547
+ Accepted: 392/392 (100.0%)
548
+ Accepted tokens: 187897
549
+ Skipped: 0 (0.0%)
550
+ Min tokens per sample: 231
551
+ Max tokens per sample: 826
552
+ Avg tokens per sample: 479.3290816326531
553
+ -----------------
554
+
555
+ ## Stats for 'total' (132540 samples (100.0%))
556
+ -----------------
557
+ Accepted: 132540/132540 (100.0%)
558
+ Accepted tokens: 67530728
559
+ Skipped: 0 (0.0%)
560
+ Min tokens per sample: 19
561
+ Max tokens per sample: 5507
562
+ Avg tokens per sample: 509.51205673758864
563
+ -----------------
564
+ ```