doubledsbv
commited on
Commit
•
93c1d72
1
Parent(s):
fc7c55d
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- llama2
|
5 |
+
- deutsch
|
6 |
+
- german
|
7 |
+
- seedbox
|
8 |
+
- awq
|
9 |
+
license: llama2
|
10 |
+
datasets:
|
11 |
+
- seedboxai/multitask_german_examples_32k
|
12 |
+
language:
|
13 |
+
- de
|
14 |
+
- en
|
15 |
+
pipeline_tag: text-generation
|
16 |
+
---
|
17 |
+
|
18 |
+
|
19 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/645ded34a45b4182d7f5c385/Lu_-yOozdIQLBe4FrmWUI.png)
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
# KafkaLM-7B-DARE_TIES-LaserRMT-QLoRA-DPO-v0.5
|
24 |
+
|
25 |
+
**KafkaLM 7b** is a Mistral 7b model - further pre-trained on a large German dataset from Björn Plüster and LAION. [leo-mistral-hessianai-7b](https://huggingface.co/LeoLM/leo-mistral-hessianai-7b) - which was finetuned on an ensemble of popular high-quality open-source instruction sets (translated from English to German).
|
26 |
+
|
27 |
+
KafkaLM 7b is a [Seedbox](https://huggingface.co/seedboxai) project trained by [Dennis Dickmann](https://huggingface.co/doubledsbv).
|
28 |
+
|
29 |
+
**Why Kafka?**
|
30 |
+
The models are proficient, yet creative, and have some tendencies to linguistically push boundaries 😊
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
## THE MODEL CAN BE TESTET HERE [Kafka-7B HF Space](https://huggingface.co/spaces/doubledsbv/Kafka-7B-DARE-TIES-QLoRa-LaserRMT-DPO)
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
## Model Details
|
39 |
+
|
40 |
+
The purpose of releasing the **KafkaLM series** is to contribute to the German AI community with a set of fine-tuned LLMs that are easy to use in everyday applications across a variety of tasks.
|
41 |
+
|
42 |
+
The main goal was to provide LLMs proficient in German, especially to be used in German-speaking business contexts where English alone is not sufficient.
|
43 |
+
|
44 |
+
|
45 |
+
## LaerRMT w/ Q-Lora
|
46 |
+
|
47 |
+
Based on the brilliant work from [laserRMT](https://github.com/cognitivecomputations/laserRMT/) team, I used the SNR implementation for identifying candiate layers to be used for the DPO training.
|
48 |
+
|
49 |
+
### Dataset
|
50 |
+
|
51 |
+
I used a 8k filtered version of the following [seedboxai/multitask_german_examples_32k](https://huggingface.co/datasets/seedboxai/multitask_german_examples_32k)
|
52 |
+
|
53 |
+
### Prompt Format
|
54 |
+
|
55 |
+
|
56 |
+
This model follows the subsequent prompt format:
|
57 |
+
|
58 |
+
```
|
59 |
+
<|system|>
|
60 |
+
Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen.</s>
|
61 |
+
<|user|>
|
62 |
+
Welche Möglichkeiten der energetischen Sanierung habe ich neben Solar und Energiespeicher?</s>
|
63 |
+
<|assistant|>
|
64 |
+
```
|
65 |
+
|
66 |
+
|
67 |
+
```
|
68 |
+
|
69 |
+
## 🧩 Configuration
|
70 |
+
|
71 |
+
```yaml
|
72 |
+
models:
|
73 |
+
- model: mistralai/Mistral-7B-v0.1
|
74 |
+
# no parameters necessary for base model
|
75 |
+
- model: seedboxai/KafkaLM-7B-German-V0.1
|
76 |
+
parameters:
|
77 |
+
density: 0.65
|
78 |
+
weight: 0.50
|
79 |
+
- model: mlabonne/Monarch-7B
|
80 |
+
parameters:
|
81 |
+
density: 0.60
|
82 |
+
weight: 0.30
|
83 |
+
- model: mayflowergmbh/Wiedervereinigung-7b-dpo-laser
|
84 |
+
parameters:
|
85 |
+
density: 0.60
|
86 |
+
weight: 0.20
|
87 |
+
merge_method: dare_ties
|
88 |
+
base_model: mistralai/Mistral-7B-v0.1
|
89 |
+
parameters:
|
90 |
+
int8_mask: true
|
91 |
+
dtype: bfloat16
|
92 |
+
random_seed: 0
|
93 |
+
```
|
94 |
+
|
95 |
+
## 💻 Usage
|
96 |
+
|
97 |
+
```python
|
98 |
+
!pip install -qU transformers accelerate
|
99 |
+
|
100 |
+
from transformers import AutoTokenizer
|
101 |
+
import transformers
|
102 |
+
import torch
|
103 |
+
|
104 |
+
model = "seedboxai/KafkaLM-7B-DARE_TIES-LaserRMT-QLoRA-DPO-v0.5"
|
105 |
+
messages = [{"role": "user", "content": "Was ist der Sinn des Lebens?"}]
|
106 |
+
|
107 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
108 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
109 |
+
pipeline = transformers.pipeline(
|
110 |
+
"text-generation",
|
111 |
+
model=model,
|
112 |
+
torch_dtype=torch.float16,
|
113 |
+
device_map="auto",
|
114 |
+
)
|
115 |
+
|
116 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
117 |
+
print(outputs[0]["generated_text"])
|
118 |
+
```
|
119 |
+
|
120 |
+
## Disclaimer
|
121 |
+
|
122 |
+
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model.
|
123 |
+
This model should only be used for research purposes. The original Llama2 license and all restrictions of datasets used to train this model apply.
|