Upload README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,106 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: google/gemma-2-2b-jpn-it
|
3 |
+
language:
|
4 |
+
- multilingual
|
5 |
+
datasets:
|
6 |
+
- mlabonne/orpo-dpo-mix-40k
|
7 |
+
library_name: transformers
|
8 |
+
license: gemma
|
9 |
+
license_link: https://ai.google.dev/gemma/terms
|
10 |
+
pipeline_tag: text-generation
|
11 |
+
tags:
|
12 |
+
- nlp
|
13 |
+
- code
|
14 |
+
quantized_by: ymcki
|
15 |
+
widget:
|
16 |
+
- messages:
|
17 |
+
- role: user
|
18 |
+
content: Can you provide ways to eat combinations of bananas and dragonfruits?
|
19 |
+
---
|
20 |
+
|
21 |
+
Original model: https://huggingface.co/google/gemma-2-2b-jpn-it
|
22 |
+
|
23 |
+
## Prompt format
|
24 |
+
|
25 |
+
```
|
26 |
+
<start_of_turn>user
|
27 |
+
{prompt}<end_of_turn>
|
28 |
+
<start_of_turn>model
|
29 |
+
<end_of_turn>
|
30 |
+
<start_of_turn>model
|
31 |
+
|
32 |
+
```
|
33 |
+
|
34 |
+
Note that this model does not support a System prompt.
|
35 |
+
|
36 |
+
This is abliterated model of [google/gemma-2-2b-jpn-it](https://huggingface.co/google/gemma-2-2b-jpn-it) using the
|
37 |
+
[method](https://medium.com/@mlabonne/uncensor-any-llm-with-abliteration-d30148b7d43e)
|
38 |
+
described by mlabonne.
|
39 |
+
|
40 |
+
Layer 17 of the original model was chosen for abliteration.
|
41 |
+
I also created another layer 18 abliterated model for comparison.
|
42 |
+
|
43 |
+
ORPO fine tuning was performed for four epoches.
|
44 |
+
|
45 |
+
| Epoch | loss | eval_loss |
|
46 |
+
| ----- | ---- | --------- |
|
47 |
+
| 1 | 10.51274610161781342 | 11.023366928100586 |
|
48 |
+
| 2 | 10.09700682163238566 | 10.434176445007324 |
|
49 |
+
| 3 | 10.35771694183349566 | 10.179500579833984 |
|
50 |
+
| 4 | 10.82988178133964582 | 10.084120750427246 |
|
51 |
+
|
52 |
+
The fine tuned model is uploaded here to be evaluated by the Open LLM Leaderboard to see if the brain damaged
|
53 |
+
suffered by the non-ORPO model can be healed.
|
54 |
+
|
55 |
+
## Benchmark (100.0*raw scores only)
|
56 |
+
|
57 |
+
Click on the model name go to the raw score json generated by Open LLM Leaderboard.
|
58 |
+
|
59 |
+
| Model | Average | IFEval | BHH | Math Lv5 | GPQA | MUSR | MMLU-PRO |
|
60 |
+
| ----- | ------- | ------ | ----|--------- | ---- | ---- | -------- |
|
61 |
+
| [gemma-2-2b-jpn-it](https://huggingface.co/datasets/open-llm-leaderboard/results/blob/main/google/gemma-2-2b-jpn-it/results_2024-10-15T15-21-39.173019.json) | 30.82 | 54.11 | 41.43 | 0.0 | 27.52 | 37.17 | 24.67 |
|
62 |
+
| gemma-2-2b-jpn-it-abliterated-17-ORPO | TBD | TBD | TBD | TBD | TBD | TBD | TBD |
|
63 |
+
| [gemma-2-2b-jpn-it-abliterated-17](https://huggingface.co/datasets/open-llm-leaderboard/results/raw/main/ymcki/gemma-2-2b-jpn-it-abliterated-17/results_2024-10-17T11-26-10.721815.json) | 16.74 | 0.0 | 29.13 | 0.0 | 25.92 | 33.73 | 11.68 |
|
64 |
+
| [gemma-2-2b-jpn-it-abliterated-18](https://huggingface.co/datasets/open-llm-leaderboard/results/raw/main/ymcki/gemma-2-2b-jpn-it-abliterated-18/results_2024-10-16T07-58-03.781979.json) | 16.74 | 0.0 | 29.13 | 0.0 | 25.92 | 33.73 | 11.68 |
|
65 |
+
|
66 |
+
Indeed, it is quite dumbed down relative to the original. Interestingly, both abliteration models have the same Open LLM results.
|
67 |
+
|
68 |
+
## How to run this model
|
69 |
+
|
70 |
+
```py
|
71 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
72 |
+
import transformers
|
73 |
+
import torch
|
74 |
+
|
75 |
+
model_id = "gemma-2-2b-jpn-it-abliterated-17-ORPO"
|
76 |
+
dtype = torch.bfloat16
|
77 |
+
|
78 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
79 |
+
model = AutoModelForCausalLM.from_pretrained(
|
80 |
+
model_id,
|
81 |
+
device_map="cuda",
|
82 |
+
torch_dtype=dtype,)
|
83 |
+
|
84 |
+
chat = [
|
85 |
+
{ "role": "user", "content": "Write a hello world program" },
|
86 |
+
]
|
87 |
+
prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
88 |
+
```
|
89 |
+
|
90 |
+
## Downloading using huggingface-cli
|
91 |
+
|
92 |
+
First, make sure you have hugginface-cli installed:
|
93 |
+
|
94 |
+
```
|
95 |
+
pip install -U "huggingface_hub[cli]"
|
96 |
+
```
|
97 |
+
|
98 |
+
Then, you can target the specific file you want:
|
99 |
+
|
100 |
+
```
|
101 |
+
huggingface-cli download ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO --include "*" --local-dir ./
|
102 |
+
```
|
103 |
+
|
104 |
+
## Credits
|
105 |
+
|
106 |
+
Thank you mlabonne for describing his abliteration method.
|