ymcki's picture
init
a924fac
|
raw
history blame
5.43 kB
---
base_model: google/gemma-2-2b-jpn-it
language:
- multilingual
datasets:
- tatsu-lab/alcapa
library_name: transformers
license: gemma
license_link: https://ai.google.dev/gemma/terms
pipeline_tag: text-generation
tags:
- nlp
- code
quantized_by: ymcki
widget:
- messages:
- role: user
content: Can you provide ways to eat combinations of bananas and dragonfruits?
---
Original model: https://huggingface.co/google/gemma-2-2b-jpn-it
## Prompt format
```
<start_of_turn>user
{prompt}<end_of_turn>
<start_of_turn>model
<end_of_turn>
<start_of_turn>model
```
Note that this model does not support a System prompt.
This is abliterated model of [google/gemma-2-2b-jpn-it](https://huggingface.co/google/gemma-2-2b-jpn-it) using the
[method](https://medium.com/@mlabonne/uncensor-any-llm-with-abliteration-d30148b7d43e)
described by mlabonne.
Layer 17 of the original model was chosen for abliteration.
I also created another layer 18 and 24 abliterated model for comparison.
ORPO fine tuning was performed for twelve epoches. Lowest eval_loss
at the end of the twevleth epoch was at 11.96 epoch. Therefore,
checkpoint at 11.96 epoch was chosen to generate the ORPO model.
The ORPO fine tuning method is based on the one described by [mlabonne](https://towardsdatascience.com/fine-tune-llama-3-with-orpo-56cfab2f9ada) but the input model was read into VRAM by [unsloth](https://github.com/unslothai/unsloth) to allow using the full 40k dataset to run on a single 3090.
Since the result of ORPO fine tuning was not satisfactory, I further fine tune it with the Stanford alcapa dataset to make it more likely to follow instruction using the [method](https://lablab.ai/t/fine-tuning-tinyllama) desribed by adebisi_oluwatomiwa878.
Twelve epoches were trained with alpaca dataset. Checkpoint at epoch 5.78
has the lowest eval_loss, so it was chosen to generate this model.
| Epoch | loss | eval_loss |
| ----- | ---- | --------- |
| 1.00 | 0.9604 | 0.9628 |
| 2.00 | 0.9957 | 0.9447 |
| 3.00 | 0.9172 | 0.8880 |
| 4.00 | 0.8936 | 0.8861 |
| 5.00 | 0.9172 | 0.8866 |
| 5.78 | 0.9017 | 0.8856 |
| 6.00 | 0.8870 | 0.8863 |
| 7.00 | 0.8718 | 0.8870 |
| 8.00 | 0.9444 | 0.8886 |
| 9.00 | 0.9028 | 0.8893 |
| 10.00 | 0.8418 | 0.8913 |
| 11.00 | 0.8500 | 0.8925 |
| 12.00 | 0.8716 | 0.8930 |
## Benchmark (100.0*raw scores only)
Click on the model name go to the raw score json generated by Open LLM Leaderboard.
| Model | Average | IFEval | BHH | Math Lv5 | GPQA | MUSR | MMLU-PRO |
| ----- | ------- | ------ | ----|--------- | ---- | ---- | -------- |
| [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 |
| [gemma-2-2b-jpn-it-abliterated-17-ORPO (4 epoches)](https://huggingface.co/datasets/open-llm-leaderboard/results/raw/main/ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO/results_2024-10-20T02-46-59.069357.json) | 29.99 | 50.94 | 38.59 | 2.87 | 27.43 | 38.23 | 21.86 |
| [gemma-2-2b-jpn-it-abliterated-17-ORPO (8 epoches)](https://huggingface.co/datasets/open-llm-leaderboard/results/raw/main/ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO/results_2024-10-24T00-00-00.000000.json) | 29.42 | 48.95 | 38.27 | 3.17 | 26.93 | 37.43 | 21.77 |
| gemma-2-2b-jpn-it-abliterated-17-ORPO (12 epoches) | TBD | TBD | TBD | TBD | TBD | TBD | TBD |
| gemma-2-2b-jpn-it-abliterated-17-ORPO-alpaca | TBD | TBD | TBD | TBD | TBD | TBD | TBD |
| [gemma-2-2b-jpn-it-abliterated-18-ORPO (4 epoches)](https://huggingface.co/datasets/open-llm-leaderboard/results/raw/main/ymcki/gemma-2-2b-jpn-it-abliterated-18-ORPO/results_2024-10-22T04-04-56.385050.json) | 29.94 | 48.97 | 40.18 | 3.02 | 26.17 | 39.42 | 21.85 |
| [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-18T15-18-46.821674.json) | 30.29 | 52.65 | 40.46 | 0.0 | 27.18 | 36.90 | 24.55 |
| [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-18T15-41-42.399571.json) | 30.61 | 53.02 | 40.96 | 0.0 | 27.35 | 37.30 | 25.05 |
| [gemma-2-2b-jpn-it-abliterated-24](https://huggingface.co/datasets/open-llm-leaderboard/results/raw/main/ymcki/gemma-2-2b-jpn-it-abliterated-24/results_2024-10-25T16-29-46.542899.json) | 30.61 | 51.37 | 40.77 | 0.0 | 27.77 | 39.02 | 24.73 |
## How to run this model
```py
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model_id = "gemma-2-2b-jpn-it-abliterated-17-ORPO-alpaca"
dtype = torch.bfloat16
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="cuda",
torch_dtype=dtype,)
chat = [
{ "role": "user", "content": "Write a hello world program" },
]
prompt = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
```
## Downloading using huggingface-cli
First, make sure you have hugginface-cli installed:
```
pip install -U "huggingface_hub[cli]"
```
Then, you can target the specific file you want:
```
huggingface-cli download ymcki/gemma-2-2b-jpn-it-abliterated-17-ORPO-alpaca --include "*" --local-dir ./
```
## Credits
Thank you adebisi_oluwatomiwa878 for describing the alpaca fine tuning method.