phires commited on
Commit
0ee7142
·
1 Parent(s): 1700d43

Initial commit

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - de
4
+ license: apache-2.0
5
+ library_name: transformers
6
+ tags:
7
+ - deutsch
8
+ - german
9
+ - seedbox
10
+ - mistral
11
+ datasets:
12
+ - seedboxai/multitask_german_examples_32k
13
+ pipeline_tag: text-generation
14
+ ---
15
+
16
+ ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/645ded34a45b4182d7f5c385/oh7yRzqtRlDtdu8sJoAdV.jpeg)
17
+
18
+
19
+ # KafkaLM-7B-German-V0.1
20
+
21
+ **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).
22
+
23
+ KafkaLM 7b is a [Seedbox](https://huggingface.co/seedboxai) project trained by [Dennis Dickmann](https://huggingface.co/doubledsbv).
24
+
25
+ **Why Kafka?**
26
+ The models are proficient, yet creative, and have some tendencies to linguistically push boundaries 😊
27
+
28
+
29
+ ## Model Details
30
+
31
+ 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.
32
+
33
+ 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.
34
+
35
+
36
+ ### Dataset
37
+
38
+ I used a 8k filtered version of the following [seedboxai/multitask_german_examples_32k](https://huggingface.co/datasets/seedboxai/multitask_german_examples_32k)
39
+
40
+ ### Prompt Format
41
+
42
+
43
+ This model follows the subsequent prompt format:
44
+
45
+ ```
46
+ <|system|>
47
+ Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen.</s>
48
+ <|user|>
49
+ Welche Möglichkeiten der energetischen Sanierung habe ich neben Solar und Energiespeicher?</s>
50
+ <|assistant|>
51
+ ```
52
+
53
+ ### Inference
54
+
55
+ Getting started with the model is straightforward
56
+
57
+ ```python
58
+ import transformers
59
+
60
+ model_id = "seedboxai/KafkaLM-7B-German-V0.1"
61
+
62
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, trust_remote_code=True)
63
+
64
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
65
+
66
+ tokenizer.padding_side = "right"
67
+ tokenizer.pad_token = tokenizer.unk_token
68
+ tokenizer.add_eos_token = False
69
+
70
+ def generate_prompt(input):
71
+ prompt = ''
72
+ sys_prompt = "Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen."
73
+
74
+ prompt += f"<|system|>\n{sys_prompt.strip()}</s>\n"
75
+ prompt += f"<|user|>\n{input.strip()}</s>\n"
76
+ prompt += f"<|assistant|>\n"
77
+
78
+ return prompt.strip()
79
+
80
+
81
+ def evaluate(
82
+ input,
83
+ temperature=0.7,
84
+ top_p=0.95,
85
+ top_k=50,
86
+ num_beams=3,
87
+ max_new_tokens=512,
88
+ #max_length=8192,
89
+ **kwargs,
90
+ ):
91
+ prompt = generate_prompt(input)
92
+
93
+ #print(prompt)
94
+
95
+ inputs = tokenizer(prompt, return_tensors="pt")
96
+ input_ids = inputs["input_ids"].to(device)
97
+ attention_mask=inputs["attention_mask"].to(device)
98
+ generation_config = GenerationConfig(
99
+ temperature=temperature,
100
+ top_p=top_p,
101
+ top_k=top_k,
102
+ num_beams=num_beams,
103
+ no_repeat_ngram_size=3,
104
+ do_sample=True,
105
+ **kwargs,
106
+ )
107
+
108
+ with torch.no_grad():
109
+ generation_output = model.generate(
110
+ early_stopping=False,
111
+ #eos_token_id=tokenizer.eos_token_id,
112
+ #pad_token_id=tokenizer.pad_token_id,
113
+ input_ids=input_ids,
114
+ attention_mask=attention_mask,
115
+ generation_config=generation_config,
116
+ return_dict_in_generate=True,
117
+ output_scores=True,
118
+ max_new_tokens=max_new_tokens,
119
+ #max_length= max_length
120
+ )
121
+ s = generation_output.sequences[0]
122
+ output = tokenizer.decode(s)
123
+ return output #.split("<|assistant|>")[1].strip()
124
+
125
+
126
+ print(evaluate("Wer ist eigentlich dieser Kafka?"))
127
+
128
+ ```
129
+
130
+ ## Disclaimer
131
+
132
+ The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model.
133
+ This model should only be used for research purposes. The original Llama2 license and all restrictions of datasets used to train this model apply.
kafkalm-7b-german-v0.1.Q2_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7c01c579d3b30dfc829f67f72944e2cd53eeba62e279d8d9f877bb3f827c5f0
3
+ size 2719242432
kafkalm-7b-german-v0.1.Q3_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c829e08ea749dec7fe4ceefff7d73bf3bbd8d64997a5d906846b409be73be5e1
3
+ size 3518986432
kafkalm-7b-german-v0.1.Q3_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0002a92d48ef9c9f87327ed9716e1b5e1fed95850748a8676bf52fe6194b108
3
+ size 3164567744
kafkalm-7b-german-v0.1.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c913cd7f7e31b3a0041bb44b6332ff88d245de636db36a9523ca102d3e62208
3
+ size 4108916928
kafkalm-7b-german-v0.1.Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5323e0752fe093f1f472b7d70384c758ec0e57d4aa21301d01ccf1658e395fcc
3
+ size 4368439488
kafkalm-7b-german-v0.1.Q4_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:589acda152b3dc7218b8be04e5d145df5c5dfea26c3b19015bfc28286abeca39
3
+ size 4140374208
kafkalm-7b-german-v0.1.Q5_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f6ddc226ef8b11c45c7cfcbf2a1390c4007c22efd4131a3eddcbe1f81b6fa10
3
+ size 4997716160
kafkalm-7b-german-v0.1.Q5_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:703b7bf64fdc7b61d588926b7a10ceb59a3a69f1afafa9ff74384fdefb20305d
3
+ size 5131409600
kafkalm-7b-german-v0.1.Q5_K_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32f04ff9c1e9afb38e8b478b83e6b89365c526d0ef90fc94e8a0a4147ba7b168
3
+ size 4997716160
kafkalm-7b-german-v0.1.Q6_K.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee882a080f749b45a87e8f1460ec50963ab28f1e55cdf06c977a4bbe92d4ed98
3
+ size 5942065344
kafkalm-7b-german-v0.1.Q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:422cea635582eafd29b249ffda15fefcf5f464d0ce25ae3f50967b742d80aecd
3
+ size 7695857856