--- library_name: transformers tags: - llama2 - deutsch - german - seedbox license: llama2 datasets: - seedboxai/multitask_german_examples_32k - seedboxai/ultra_feedback_german_modified_v1 language: - de pipeline_tag: text-generation --- ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/645ded34a45b4182d7f5c385/r3gmYxFn0532BUjIPULva.jpeg) # KafkaLM-13B-German-V0.1 **KafkaLM 13b** is a Llama2 13b model - further pre-trained on a large German dataset from Björn Plüster and LAION. [leo-hessianai-13b](https://huggingface.co/LeoLM/leo-hessianai-13b) - which was finetuned on an ensemble of popular high-quality open-source instruction sets (translated from English to German). KafkaLM 13b is a [Seedbox](https://huggingface.co/seedboxai) project trained by [Dennis Dickmann](https://huggingface.co/doubledsbv). **Why Kafka?** The models are proficient, yet creative, and have some tendencies to linguistically push boundaries 😊 ## Model Details 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. 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. ### DPO The model has been aligned with a german and modified version of the ultra feedback dataset from huggingface. ### Dataset I used a 8k filtered version of the following [seedboxai/multitask_german_examples_32k](https://huggingface.co/datasets/seedboxai/multitask_german_examples_32k) ### Prompt Format This model follows the subsequent prompt format: ``` <|system|> Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen. <|user|> Welche Möglichkeiten der energetischen Sanierung habe ich neben Solar und Energiespeicher? <|assistant|> ``` ### Inference Getting started with the model is straightforward ```python import transformers model_id = "seedboxai/KafkaLM-13B-German-V0.1-DPO" model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True) tokenizer = AutoTokenizer.from_pretrained(model_id) tokenizer.padding_side = "right" tokenizer.pad_token = tokenizer.unk_token tokenizer.add_eos_token = False def generate_prompt(input): prompt = '' sys_prompt = "Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen." prompt += f"<|system|>\n{sys_prompt.strip()}\n" prompt += f"<|user|>\n{input.strip()}\n" prompt += f"<|assistant|>\n" return prompt.strip() generate_text = transformers.pipeline( model=model, tokenizer=tokenizer, return_full_text=True, task='text-generation', temperature=0.5, max_new_tokens=512, top_p=0.95, top_k=50, do_sample=True, ) print(generate_text(generate_prompt("Wer ist eigentlich dieser Kafka?"))) ``` ## Disclaimer The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. This model should only be used for research purposes. The original Llama2 license and all restrictions of datasets used to train this model apply.