SebastianBodza
commited on
Commit
•
1967b9d
1
Parent(s):
3309308
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,58 @@
|
|
1 |
---
|
2 |
license: cc-by-nc-sa-4.0
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: cc-by-nc-sa-4.0
|
3 |
+
datasets:
|
4 |
+
- SebastianBodza/Ger_WizardLM_evol_instruct_70k_V0
|
5 |
+
language:
|
6 |
+
- de
|
7 |
---
|
8 |
+
# DElefant:
|
9 |
+
<img src="https://huggingface.co/SebastianBodza/DElefant-MPT/resolve/main/badge_gerlefant.png" style="max-width:200px">
|
10 |
+
DElefant is a LLM developed for instruction tuned German interactions. This version is built on top of the MPT-30B model from <a href="https://huggingface.co/mosaicml/mpt-30b">MosaicML</a> with a opus-mt translated and afterwards filtered <a href="https://huggingface.co/datasets/SebastianBodza/Ger_WizardLM_evol_instruct_70k_V0">WizardLM</a> dataset. The evolved dataset led to SOTA english LLMs and we hope by incoperating the translated dataset to a base model we can leverage the capabilities for various tasks in german including Code generation.
|
11 |
+
Due to limitation in translation, the comments inside of the code blocks remained english, however the Coding was kept in working condition.
|
12 |
+
|
13 |
+
## Model Description:
|
14 |
+
QLoRa-Finetuning of the MPT-30B model on two RTX 3090 with the translated WizardLM Dataset.
|
15 |
+
|
16 |
+
## Roadmap:
|
17 |
+
If there is sufficient demand, additional adjustments can be made:
|
18 |
+
- Native German generated dataset
|
19 |
+
- Full Fine-Tuning of larger LLMs e.g. Falcon, Starcoderplus, ...
|
20 |
+
|
21 |
+
## How to use:
|
22 |
+
Prompt-Template:
|
23 |
+
```
|
24 |
+
{instruction}\n\n### Response:
|
25 |
+
```
|
26 |
+
Code example for inference:
|
27 |
+
```
|
28 |
+
import torch
|
29 |
+
from peft import PeftModel, PeftConfig
|
30 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
31 |
+
|
32 |
+
# Load peft config for pre-trained checkpoint etc.
|
33 |
+
config = PeftConfig.from_pretrained("SebastianBodza/DElefant-MPT")
|
34 |
+
|
35 |
+
# load base LLM model and tokenizer
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained( "mosaicml/mpt-30b",
|
37 |
+
padding_side="right",
|
38 |
+
use_fast=True)
|
39 |
+
model = AutoModelForCausalLM.from_pretrained("mosaicml/mpt-30b", device_map="auto", load_in_8bit=True)
|
40 |
+
|
41 |
+
# Load the Lora model
|
42 |
+
model = PeftModel.from_pretrained(model, "SebastianBodza/DElefant-MPT", device_map={"":0})
|
43 |
+
model.eval()
|
44 |
+
|
45 |
+
frage = "Wie heißt der Bundeskanzler?"
|
46 |
+
prompt = f"{frage}\n\n### Response:"
|
47 |
+
|
48 |
+
txt = tokenizer(prompt, return_tensors="pt").to("cuda")
|
49 |
+
txt = model.generate(**txt,
|
50 |
+
max_new_tokens=256,
|
51 |
+
eos_token_id=tokenizer.eos_token_id)
|
52 |
+
tokenizer.decode(txt[0], skip_special_tokens=True)
|
53 |
+
```
|
54 |
+
## Training:
|
55 |
+
Training was based on Llama-X with the adaptions of WizardLMs training script and additional adjustments to QLoRa tune. MPT-Code from <a href="https://huggingface.co/SebastianBodza/mpt-30B-qlora-multi_GPU">SebastianBodza/mpt-30B-qlora-multi_GPU</a>
|
56 |
+
|
57 |
+
<img src="https://huggingface.co/SebastianBodza/DElefant-MPT/resolve/main/train_loss_DElefant.svg" style="max-width:350px">
|
58 |
+
|