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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: LeoLM/leo-hessianai-13b-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: llama2
|
16 |
+
model_creator: LAION LeoLM
|
17 |
+
model_name: Leo Hessianai 13B Chat
|
18 |
+
model_type: llama
|
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 |
+
|
34 |
+
<!-- header start -->
|
35 |
+
<!-- 200823 -->
|
36 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
37 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
38 |
+
</div>
|
39 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
40 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
41 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
42 |
+
</div>
|
43 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
44 |
+
<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>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
<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>
|
48 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
49 |
+
<!-- header end -->
|
50 |
+
|
51 |
+
# Leo Hessianai 13B Chat - GPTQ
|
52 |
+
- Model creator: [LAION LeoLM](https://huggingface.co/LeoLM)
|
53 |
+
- Original model: [Leo Hessianai 13B Chat](https://huggingface.co/LeoLM/leo-hessianai-13b-chat)
|
54 |
+
|
55 |
+
<!-- description start -->
|
56 |
+
## Description
|
57 |
+
|
58 |
+
This repo contains GPTQ model files for [LAION LeoLM's Leo Hessianai 13B Chat](https://huggingface.co/LeoLM/leo-hessianai-13b-chat).
|
59 |
+
|
60 |
+
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.
|
61 |
+
|
62 |
+
<!-- description end -->
|
63 |
+
<!-- repositories-available start -->
|
64 |
+
## Repositories available
|
65 |
+
|
66 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-AWQ)
|
67 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-GPTQ)
|
68 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-GGUF)
|
69 |
+
* [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)
|
70 |
+
<!-- repositories-available end -->
|
71 |
+
|
72 |
+
<!-- prompt-template start -->
|
73 |
+
## Prompt template: ChatML
|
74 |
+
|
75 |
+
```
|
76 |
+
<|im_start|>system
|
77 |
+
{system_message}<|im_end|>
|
78 |
+
<|im_start|>user
|
79 |
+
{prompt}<|im_end|>
|
80 |
+
<|im_start|>assistant
|
81 |
+
|
82 |
+
```
|
83 |
+
|
84 |
+
<!-- prompt-template end -->
|
85 |
+
|
86 |
+
|
87 |
+
<!-- README_GPTQ.md-provided-files start -->
|
88 |
+
## Provided files, and GPTQ parameters
|
89 |
+
|
90 |
+
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
91 |
+
|
92 |
+
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
93 |
+
|
94 |
+
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.
|
95 |
+
|
96 |
+
<details>
|
97 |
+
<summary>Explanation of GPTQ parameters</summary>
|
98 |
+
|
99 |
+
- Bits: The bit size of the quantised model.
|
100 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
101 |
+
- 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.
|
102 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
103 |
+
- 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).
|
104 |
+
- 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.
|
105 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
|
106 |
+
|
107 |
+
</details>
|
108 |
+
|
109 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
110 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
111 |
+
| [main](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-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. |
|
112 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-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. |
|
113 |
+
| [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-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. |
|
114 |
+
| [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-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. |
|
115 |
+
| [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-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. |
|
116 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/leo-hessianai-13B-chat-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. |
|
117 |
+
|
118 |
+
<!-- README_GPTQ.md-provided-files end -->
|
119 |
+
|
120 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
121 |
+
## How to download, including from branches
|
122 |
+
|
123 |
+
### In text-generation-webui
|
124 |
+
|
125 |
+
To download from the `main` branch, enter `TheBloke/leo-hessianai-13B-chat-GPTQ` in the "Download model" box.
|
126 |
+
|
127 |
+
To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/leo-hessianai-13B-chat-GPTQ:gptq-4bit-32g-actorder_True`
|
128 |
+
|
129 |
+
### From the command line
|
130 |
+
|
131 |
+
I recommend using the `huggingface-hub` Python library:
|
132 |
+
|
133 |
+
```shell
|
134 |
+
pip3 install huggingface-hub
|
135 |
+
```
|
136 |
+
|
137 |
+
To download the `main` branch to a folder called `leo-hessianai-13B-chat-GPTQ`:
|
138 |
+
|
139 |
+
```shell
|
140 |
+
mkdir leo-hessianai-13B-chat-GPTQ
|
141 |
+
huggingface-cli download TheBloke/leo-hessianai-13B-chat-GPTQ --local-dir leo-hessianai-13B-chat-GPTQ --local-dir-use-symlinks False
|
142 |
+
```
|
143 |
+
|
144 |
+
To download from a different branch, add the `--revision` parameter:
|
145 |
+
|
146 |
+
```shell
|
147 |
+
mkdir leo-hessianai-13B-chat-GPTQ
|
148 |
+
huggingface-cli download TheBloke/leo-hessianai-13B-chat-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir leo-hessianai-13B-chat-GPTQ --local-dir-use-symlinks False
|
149 |
+
```
|
150 |
+
|
151 |
+
<details>
|
152 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
153 |
+
|
154 |
+
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.
|
155 |
+
|
156 |
+
The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
|
157 |
+
|
158 |
+
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).
|
159 |
+
|
160 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
161 |
+
|
162 |
+
```shell
|
163 |
+
pip3 install hf_transfer
|
164 |
+
```
|
165 |
+
|
166 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
167 |
+
|
168 |
+
```shell
|
169 |
+
mkdir leo-hessianai-13B-chat-GPTQ
|
170 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/leo-hessianai-13B-chat-GPTQ --local-dir leo-hessianai-13B-chat-GPTQ --local-dir-use-symlinks False
|
171 |
+
```
|
172 |
+
|
173 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
174 |
+
</details>
|
175 |
+
|
176 |
+
### With `git` (**not** recommended)
|
177 |
+
|
178 |
+
To clone a specific branch with `git`, use a command like this:
|
179 |
+
|
180 |
+
```shell
|
181 |
+
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/leo-hessianai-13B-chat-GPTQ
|
182 |
+
```
|
183 |
+
|
184 |
+
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.)
|
185 |
+
|
186 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
187 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
188 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
189 |
+
|
190 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
191 |
+
|
192 |
+
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.
|
193 |
+
|
194 |
+
1. Click the **Model tab**.
|
195 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/leo-hessianai-13B-chat-GPTQ`.
|
196 |
+
- To download from a specific branch, enter for example `TheBloke/leo-hessianai-13B-chat-GPTQ:gptq-4bit-32g-actorder_True`
|
197 |
+
- see Provided Files above for the list of branches for each option.
|
198 |
+
3. Click **Download**.
|
199 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
200 |
+
5. In the top left, click the refresh icon next to **Model**.
|
201 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `leo-hessianai-13B-chat-GPTQ`
|
202 |
+
7. The model will automatically load, and is now ready for use!
|
203 |
+
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.
|
204 |
+
* 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`.
|
205 |
+
9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
|
206 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
207 |
+
|
208 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
209 |
+
## How to use this GPTQ model from Python code
|
210 |
+
|
211 |
+
### Install the necessary packages
|
212 |
+
|
213 |
+
Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
214 |
+
|
215 |
+
```shell
|
216 |
+
pip3 install transformers optimum
|
217 |
+
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
|
218 |
+
```
|
219 |
+
|
220 |
+
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
|
221 |
+
|
222 |
+
```shell
|
223 |
+
pip3 uninstall -y auto-gptq
|
224 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
225 |
+
cd AutoGPTQ
|
226 |
+
git checkout v0.4.2
|
227 |
+
pip3 install .
|
228 |
+
```
|
229 |
+
|
230 |
+
### You can then use the following code
|
231 |
+
|
232 |
+
```python
|
233 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
234 |
+
|
235 |
+
model_name_or_path = "TheBloke/leo-hessianai-13B-chat-GPTQ"
|
236 |
+
# To use a different branch, change revision
|
237 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
238 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
239 |
+
device_map="auto",
|
240 |
+
trust_remote_code=False,
|
241 |
+
revision="main")
|
242 |
+
|
243 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
244 |
+
|
245 |
+
prompt = "Tell me about AI"
|
246 |
+
prompt_template=f'''<|im_start|>system
|
247 |
+
{system_message}<|im_end|>
|
248 |
+
<|im_start|>user
|
249 |
+
{prompt}<|im_end|>
|
250 |
+
<|im_start|>assistant
|
251 |
+
'''
|
252 |
+
|
253 |
+
print("\n\n*** Generate:")
|
254 |
+
|
255 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
|
256 |
+
output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
|
257 |
+
print(tokenizer.decode(output[0]))
|
258 |
+
|
259 |
+
# Inference can also be done using transformers' pipeline
|
260 |
+
|
261 |
+
print("*** Pipeline:")
|
262 |
+
pipe = pipeline(
|
263 |
+
"text-generation",
|
264 |
+
model=model,
|
265 |
+
tokenizer=tokenizer,
|
266 |
+
max_new_tokens=512,
|
267 |
+
do_sample=True,
|
268 |
+
temperature=0.7,
|
269 |
+
top_p=0.95,
|
270 |
+
top_k=40,
|
271 |
+
repetition_penalty=1.1
|
272 |
+
)
|
273 |
+
|
274 |
+
print(pipe(prompt_template)[0]['generated_text'])
|
275 |
+
```
|
276 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
277 |
+
|
278 |
+
<!-- README_GPTQ.md-compatibility start -->
|
279 |
+
## Compatibility
|
280 |
+
|
281 |
+
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).
|
282 |
+
|
283 |
+
[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.
|
284 |
+
|
285 |
+
[Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
|
286 |
+
<!-- README_GPTQ.md-compatibility end -->
|
287 |
+
|
288 |
+
<!-- footer start -->
|
289 |
+
<!-- 200823 -->
|
290 |
+
## Discord
|
291 |
+
|
292 |
+
For further support, and discussions on these models and AI in general, join us at:
|
293 |
+
|
294 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
295 |
+
|
296 |
+
## Thanks, and how to contribute
|
297 |
+
|
298 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
299 |
+
|
300 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
301 |
+
|
302 |
+
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.
|
303 |
+
|
304 |
+
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.
|
305 |
+
|
306 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
307 |
+
|
308 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
309 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
310 |
+
|
311 |
+
**Special thanks to**: Aemon Algiz.
|
312 |
+
|
313 |
+
**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
|
314 |
+
|
315 |
+
|
316 |
+
Thank you to all my generous patrons and donaters!
|
317 |
+
|
318 |
+
And thank you again to a16z for their generous grant.
|
319 |
+
|
320 |
+
<!-- footer end -->
|
321 |
+
|
322 |
+
# Original model card: LAION LeoLM's Leo Hessianai 13B Chat
|
323 |
+
|
324 |
+
# LAION LeoLM: **L**inguistically **E**nhanced **O**pen **L**anguage **M**odel
|
325 |
+
Meet LeoLM, the first open and commercially available German Foundation Language Model built on Llama-2.
|
326 |
+
Our models extend Llama-2's capabilities into German through continued pretraining on a large corpus of German-language and mostly locality specific text.
|
327 |
+
Thanks to a compute grant at HessianAI's new supercomputer **42**, we release two foundation models trained with 8k context length,
|
328 |
+
[`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! 👀).
|
329 |
+
With this release, we hope to bring a new wave of opportunities to German open-source and commercial LLM research and accelerate adoption.
|
330 |
+
Read our [blog post]() or our paper (preprint coming soon) for more details!
|
331 |
+
|
332 |
+
*A project by Björn Plüster and Christoph Schuhmann in collaboration with LAION and HessianAI.*
|
333 |
+
|
334 |
+
## LeoLM Chat
|
335 |
+
`LeoLM/leo-hessianai-13b-chat` is a German chat model built on our foundation model `LeoLM/leo-hessianai-13b` and finetuned on a selection of German instruction datasets.
|
336 |
+
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:
|
337 |
+
```
|
338 |
+
{
|
339 |
+
"first_turn": 6.525,
|
340 |
+
"second_turn": 5.15,
|
341 |
+
"categories": {
|
342 |
+
"writing": 6.925,
|
343 |
+
"roleplay": 6.7,
|
344 |
+
"reasoning": 4.55,
|
345 |
+
"math": 3.25,
|
346 |
+
"coding": 3.45,
|
347 |
+
"extraction": 5.4,
|
348 |
+
"stem": 7.55,
|
349 |
+
"humanities": 8.875
|
350 |
+
},
|
351 |
+
"average": 5.8375
|
352 |
+
}
|
353 |
+
```
|
354 |
+
|
355 |
+
## Model Details
|
356 |
+
|
357 |
+
- **Finetuned from:** [LeoLM/leo-hessianai-13b](https://huggingface.co/LeoLM/leo-hessianai-7b)
|
358 |
+
- **Model type:** Causal decoder-only transformer language model
|
359 |
+
- **Language:** English and German
|
360 |
+
- **Demo:** [Web Demo]()
|
361 |
+
- **License:** [LLAMA 2 COMMUNITY LICENSE AGREEMENT](https://huggingface.co/meta-llama/Llama-2-70b/raw/main/LICENSE.txt)
|
362 |
+
- **Contact:** [LAION Discord](https://discord.com/invite/eq3cAMZtCC) or [Björn Plüster](mailto:[email protected])
|
363 |
+
|
364 |
+
|
365 |
+
## Use in 🤗Transformers
|
366 |
+
First install direct dependencies:
|
367 |
+
```
|
368 |
+
pip install transformers torch sentencepiece
|
369 |
+
```
|
370 |
+
If you want faster inference using flash-attention2, you need to install these dependencies:
|
371 |
+
```bash
|
372 |
+
pip install packaging ninja
|
373 |
+
pip install flash-attn==v2.1.1 --no-build-isolation
|
374 |
+
pip install git+https://github.com/HazyResearch/[email protected]#subdirectory=csrc/rotary
|
375 |
+
```
|
376 |
+
Then load the model in transformers:
|
377 |
+
```python
|
378 |
+
from transformers import pipeline
|
379 |
+
import torch
|
380 |
+
|
381 |
+
system_prompt = """<|im_start|>system
|
382 |
+
Dies ist eine Unterhaltung zwischen einem intelligenten, hilfsbereitem KI-Assistenten und einem Nutzer.
|
383 |
+
Der Assistent gibt ausführliche, hilfreiche und ehrliche Antworten.<|im_end|>
|
384 |
+
|
385 |
+
"""
|
386 |
+
prompt_format = "<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
|
387 |
+
prompt = "Erkläre mir wie die Fahrradwegesituation in Hamburg ist."
|
388 |
+
|
389 |
+
generator = pipeline(model="LeoLM/leo-hessianai-13b-chat", device="cuda", torch_dtype=torch.float16, trust_remote_code=True) # True for flash-attn2 else False
|
390 |
+
print(generator(prompt_format.format(prompt=prompt), do_sample=True, top_p=0.95, max_length=8192))
|
391 |
+
```
|
392 |
+
|
393 |
+
"*Hamburg verfügt über ein umfangreiches Netzwerk an Radwegen, das ein effizientes und angenehmes Radfahren in der ganzen Stadt ermöglicht. Die Radwege variieren in Bezug auf ihre Qualität, wobei einige erstklassig mit eigens für Radfahrer reservierten Spuren sind, während andere einfache Fahrradsymbole auf dem Boden haben, die anzeigen, dass Radfahrer abwechselnd mit dem Autoverkehr auf der Straße fahren sollten. Einige Nebenstraßen haben auch spezielle Fahrradspuren, wobei einige mit Bordsteinabsenkungen zur Seite der Autospuren markiert sind. Zusätzlich haben viele Hauptstraßen, insbesondere in Nebenstraßen, fahrradfreundliche Abstände zwischen den geparkten Autos und dem Gehweg, was ein bequemes Fahren auf der Straße ermöglicht. Der Bau von Radschnellwegen, die schnelles und effizientes Radfahren in und aus der Stadt ermöglichen, ist im Gange und wird in den kommenden Jahren fortgesetzt. Insgesamt sind die Radwege in Hamburg weitläufig und gut ausgeschildert, was es zu einem angenehmen Ort macht, um mit dem Fahrrad zu fahren.*"
|
394 |
+
|
395 |
+
## Prompting / Prompt Template
|
396 |
+
|
397 |
+
Prompt dialogue template (ChatML format):
|
398 |
+
|
399 |
+
```
|
400 |
+
"""
|
401 |
+
<|im_start|>system
|
402 |
+
{system_message}<|im_end|>
|
403 |
+
<|im_start|>user
|
404 |
+
{prompt}<|im_end|>
|
405 |
+
<|im_start|>assistant
|
406 |
+
"""
|
407 |
+
```
|
408 |
+
|
409 |
+
The model input can contain multiple conversation turns between user and assistant, e.g.
|
410 |
+
```
|
411 |
+
<|im_start|>user
|
412 |
+
{prompt 1}<|im_end|>
|
413 |
+
<|im_start|>assistant
|
414 |
+
{reply 1}<|im_end|>
|
415 |
+
<|im_start|>user
|
416 |
+
{prompt 2}<|im_end|>
|
417 |
+
<|im_start|>assistant
|
418 |
+
(...)
|
419 |
+
```
|
420 |
+
|
421 |
+
## Ethical Considerations and Limitations
|
422 |
+
|
423 |
+
LeoLM has been tested in English and German, and has not covered, nor could it cover all scenarios.
|
424 |
+
For these reasons, as with all LLMs, the potential outputs of `LeoLM/leo-hessianai-13b-chat` cannot be predicted
|
425 |
+
in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses
|
426 |
+
to user prompts. Therefore, before deploying any applications of `LeoLM/leo-hessianai-13b-chat`, developers should
|
427 |
+
perform safety testing and tuning tailored to their specific applications of the model.
|
428 |
+
|
429 |
+
Please see Meta's [Responsible Use Guide](https://ai.meta.com/llama/responsible-use-guide/).
|
430 |
+
|
431 |
+
## Finetuning Details
|
432 |
+
|
433 |
+
| Hyperparameter | Value |
|
434 |
+
|---|---|
|
435 |
+
| Num epochs | 3 |
|
436 |
+
| Examples per epoch | 131214 |
|
437 |
+
| Global batch size | 256 |
|
438 |
+
| Learning rate | 3e-5 |
|
439 |
+
| Warmup steps | 100 |
|
440 |
+
| LR scheduler | Cosine |
|
441 |
+
| Adam betas | (0.9, 0.95) |
|
442 |
+
|
443 |
+
|
444 |
+
## Dataset Details
|
445 |
+
```
|
446 |
+
## Stats for 'Subset of OpenAssistant/OASST-DE' (3534 samples (100.0%))
|
447 |
+
-----------------
|
448 |
+
Accepted: 3534/3534 (100.0%)
|
449 |
+
Accepted tokens: 2259302
|
450 |
+
Skipped: 0 (0.0%)
|
451 |
+
Min tokens per sample: 29
|
452 |
+
Max tokens per sample: 2484
|
453 |
+
Avg tokens per sample: 639.3044708545557
|
454 |
+
-----------------
|
455 |
+
|
456 |
+
## Stats for 'Subset of FreedomIntelligence/evol-instruct-deutsch' (57841 samples (100.0%))
|
457 |
+
-----------------
|
458 |
+
Accepted: 57841/57841 (100.0%)
|
459 |
+
Accepted tokens: 42958192
|
460 |
+
Skipped: 0 (0.0%)
|
461 |
+
Min tokens per sample: 33
|
462 |
+
Max tokens per sample: 5507
|
463 |
+
Avg tokens per sample: 742.6944900675991
|
464 |
+
-----------------
|
465 |
+
|
466 |
+
## Stats for 'Subset of FreedomIntelligence/alpaca-gpt4-deutsch' (48969 samples (100.0%))
|
467 |
+
-----------------
|
468 |
+
Accepted: 48969/48969 (100.0%)
|
469 |
+
Accepted tokens: 13372005
|
470 |
+
Skipped: 0 (0.0%)
|
471 |
+
Min tokens per sample: 19
|
472 |
+
Max tokens per sample: 1359
|
473 |
+
Avg tokens per sample: 273.07082031489307
|
474 |
+
-----------------
|
475 |
+
|
476 |
+
## Stats for 'Subset of LeoLM/OpenSchnabeltier' (21314 samples (100.0%))
|
477 |
+
-----------------
|
478 |
+
Accepted: 21314/21314 (100.0%)
|
479 |
+
Accepted tokens: 8134690
|
480 |
+
Skipped: 0 (0.0%)
|
481 |
+
Min tokens per sample: 25
|
482 |
+
Max tokens per sample: 1202
|
483 |
+
Avg tokens per sample: 381.65947264708643
|
484 |
+
-----------------
|
485 |
+
|
486 |
+
## Stats for 'Subset of LeoLM/German_Poems' (490 samples (100.0%))
|
487 |
+
-----------------
|
488 |
+
Accepted: 490/490 (100.0%)
|
489 |
+
Accepted tokens: 618642
|
490 |
+
Skipped: 0 (0.0%)
|
491 |
+
Min tokens per sample: 747
|
492 |
+
Max tokens per sample: 1678
|
493 |
+
Avg tokens per sample: 1262.534693877551
|
494 |
+
-----------------
|
495 |
+
|
496 |
+
## Stats for 'Subset of LeoLM/German_Songs' (392 samples (100.0%))
|
497 |
+
-----------------
|
498 |
+
Accepted: 392/392 (100.0%)
|
499 |
+
Accepted tokens: 187897
|
500 |
+
Skipped: 0 (0.0%)
|
501 |
+
Min tokens per sample: 231
|
502 |
+
Max tokens per sample: 826
|
503 |
+
Avg tokens per sample: 479.3290816326531
|
504 |
+
-----------------
|
505 |
+
|
506 |
+
## Stats for 'total' (132540 samples (100.0%))
|
507 |
+
-----------------
|
508 |
+
Accepted: 132540/132540 (100.0%)
|
509 |
+
Accepted tokens: 67530728
|
510 |
+
Skipped: 0 (0.0%)
|
511 |
+
Min tokens per sample: 19
|
512 |
+
Max tokens per sample: 5507
|
513 |
+
Avg tokens per sample: 509.51205673758864
|
514 |
+
-----------------
|
515 |
+
```
|