File size: 6,361 Bytes
55b7fbc
b21ace7
1a065d9
b21ace7
 
 
 
 
1a065d9
d032d3e
 
 
 
 
 
 
 
aad36d1
d032d3e
 
aad36d1
 
 
 
 
 
 
 
 
 
d032d3e
 
 
 
 
 
 
aad36d1
d032d3e
 
aad36d1
 
 
 
 
 
 
 
 
 
d032d3e
 
 
 
 
 
aad36d1
 
d032d3e
 
aad36d1
 
d032d3e
 
aad36d1
 
d032d3e
 
aad36d1
 
d032d3e
 
1a065d9
 
 
55b7fbc
 
b21ace7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834c49c
b21ace7
 
 
 
 
 
 
297899b
b21ace7
 
 
 
 
 
 
 
 
5ef0b24
b21ace7
 
 
 
 
aad36d1
b21ace7
 
297899b
b21ace7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
---
base_model: LemiSt/SmolLM-135M-de
library_name: transformers
license: apache-2.0
tags:
- axolotl
- generated_from_trainer
model-index:
- name: SmolLM-135M-instruct-de-merged
  results:
      - task:
          type: text-generation
        dataset:
          name: openai/MMMLU
          type: mmlu
        metrics:
          - name: MMMLU(DE_DE) (0-Shot)
            type: accuracy
            value: 25.57
            verified: false
      - task:
          type: text-generation
        dataset:
          name: openai/MMMLU
          type: mmlu
        metrics:
          - name: MMMLU(DE_DE) (5-Shot)
            type: accuracy
            value: 24.88
            verified: false
      - task:
          type: text-generation
        dataset:
          name: alexandrainst/m_arc
          type: arc
        metrics:
          - name: ARC Challenge (DE) (0-Shot)
            type: accuracy
            value: 24.29
            verified: false
      - task:
          type: text-generation
        dataset:
          name: alexandrainst/m_arc
          type: arc
        metrics:
          - name: ARC Challenge (DE) (5-Shot)
            type: accuracy
            value: 24.38
            verified: false
      - task:
          type: text-generation
        dataset:
          name: deutsche-telekom/Ger-RAG-eval
          type: Ger-RAG-eval
        metrics:
          - name: Task 1
            type: accuracy
            value: 25.2
            verified: false
          - name: Task 2
            type: accuracy
            value: 27.1
            verified: false
          - name: Task 3
            type: accuracy
            value: 50.9
            verified: false
          - name: Task 4
            type: accuracy
            value: 50.0
            verified: false
language:
- de
pipeline_tag: text-generation
---

[<img src="https://raw.githubusercontent.com/axolotl-ai-cloud/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/axolotl-ai-cloud/axolotl)
<details><summary>See axolotl config</summary>

axolotl version: `0.4.1`
```yaml
base_model: LemiSt/SmolLM-135M-de
model_type: LlamaForCausalLM
tokenizer_type: GPT2Tokenizer
load_in_8bit: false
load_in_4bit: true
strict: false
push_dataset_to_hub:
datasets:
  - path: smollm_dataset.json
    type: sharegpt
    conversation: chatml
chat_template: chatml
default_system_prompt: "Du bist ein hilfreicher KI-Assistent."
dataset_prepared_path:
val_set_size: 0.05
adapter: qlora
lora_model_dir:
sequence_len: 2048
sample_packing: true
lora_r: 32
lora_alpha: 16
lora_dropout: 0.05
lora_target_modules:
lora_target_linear: true
lora_fan_in_fan_out:
wandb_project: smollm-135m-de-sft-qlora
wandb_entity:
wandb_watch:
wandb_name:
wandb_log_model:
output_dir: ./outputs/smollm-135m-sft-qlora-out
hub_model_id: LemiSt/SmolLM-135M-instruct-de
hub_strategy: end
gradient_accumulation_steps: 16
micro_batch_size: 2
num_epochs: 2
optimizer: adamw_bnb_8bit
torchdistx_path:
lr_scheduler: cosine
learning_rate: 0.003
train_on_inputs: false
group_by_length: false
bf16: true
fp16: false
tf32: false
gradient_checkpointing: true
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention: true
gptq_groupsize:
gptq_model_v1:
warmup_steps: 20
evals_per_epoch: 4
saves_per_epoch: 4
debug:
deepspeed:
weight_decay: 0.1
fsdp:
fsdp_config:
special_tokens:
  bos_token: "<|endoftext|>"
  eos_token: "<|endoftext|>"
  unk_token: "<|endoftext|>"

```

</details><br>

# SmolLM-135M-instruct-de-merged

This model is a fine-tuned version of [LemiSt/SmolLM-135M-de](https://huggingface.co/LemiSt/SmolLM-135M-de) on an internal testing dataset with general chat examples.
It achieves the following results on the evaluation set:
- Loss: 0.7453

## Model description

For more information, see the model card of the [base model](https://huggingface.co/LemiSt/SmolLM-135M-de). This adapter was trained using qlora at rank 32 with alpha 16, applying a dataset of around 200k german chat samples for two epochs.

## Intended uses & limitations

Mainly playing around with tiny chat models - while the output is generally intact German and the model somewhat follows instructions, it makes too many mistakes to be deployed in a real world setting.

### Usage example
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
checkpoint = "LemiSt/SmolLM-135M-instruct-de-merged"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map=device, torch_dtype=torch.bfloat16)
messages = [
  {"role": "system", "content": "Du bist ein hilfreicher Assistent."},
  {"role": "user", "content": "Was ist der Sinn des Lebens?"}
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, return_tensors="pt", add_generation_prompt=True).to(device)
outputs = model.generate(inputs, max_new_tokens=256, do_sample=True, temperature=0.4, top_p=0.9, repetition_penalty=1.1, top_k=512)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
```
## Training and evaluation data

Internal dataset which was compiled for another experiment.

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 0.003
- train_batch_size: 2
- eval_batch_size: 2
- seed: 42
- gradient_accumulation_steps: 16
- total_train_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 20
- num_epochs: 2

### Training results

| Training Loss | Epoch  | Step | Validation Loss |
|:-------------:|:------:|:----:|:---------------:|
| 1.6406        | 0.0005 | 1    | 1.6172          |
| 0.8219        | 0.2497 | 501  | 0.8901          |
| 0.8646        | 0.4995 | 1002 | 0.8370          |
| 0.8651        | 0.7492 | 1503 | 0.8052          |
| 0.7231        | 0.9989 | 2004 | 0.7827          |
| 0.7632        | 1.2468 | 2505 | 0.7673          |
| 0.7543        | 1.4967 | 3006 | 0.7536          |
| 0.7782        | 1.7466 | 3507 | 0.7469          |
| 0.6724        | 1.9966 | 4008 | 0.7453          |


### Framework versions

- PEFT 0.12.0
- Transformers 4.45.0.dev0
- Pytorch 2.3.1+cu121
- Datasets 2.21.0
- Tokenizers 0.19.1