CoolFace
Modelpublic

ymcki/gemma-2-2b-ORPO-jpn-it-abliterated-18

sourceHugging Facegemmaupdated 2y agoView on Hugging Face
2likes37downloads
Model Card

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.

Since gemma-2-2b-jpn-it-ablitered-18 is slightly brain damaged compare to the original gemma-2-2b-jpn-it. I decided to try ORPO fine tuning to see if it can be headled.

Using the gemma-2-2b base model, I employed the ORPO method described by mlabonne but the input model was read into VRAM by unsloth to allow using the full 40k dataset to run on a single 3090.

Five epoches was run. Smallest eval_loss was achieve at epoch 7.00. Checkpoint at epoch 7.00 is used to obtain a model adapter and applied it to gemma-2-2b-jpn-it-ablitered-18 to obtain this model.

Epochlosseval_losseval_logps/rejectedeval_logps/chosen
1.000.97541.0344-1.1506-0.7516
2.000.96291.0173-1.2694-0.7351
3.000.74351.0087-1.4922-0.7388
4.001.05951.0026-1.5920-0.7310
5.001.05251.0000-1.6313-0.7311
6.001.16281.0014-1.7263-0.7393
7.000.89940.9971-1.7264-0.7324
8.000.74481.0056-1.7790-0.7482
9.000.68011.0028-1.7794-0.7429
10.000.98681.0069-1.8065-0.7505

This model is uploaded here to be evaluated by the Open LLM Leaderboard. Further ORPO fine tuning is currently underway to see if it can regain its sanity. You can play with this model first or wait until I am done with the fine tuning.

Benchmark (100.0*raw scores only)

Click on the model name go to the raw score json generated by Open LLM Leaderboard.

ModelAverageIFEvalBHHMath Lv5GPQAMUSRMMLU-PRO
gemma-2-2b-jpn-it30.8254.1141.430.027.5237.1724.67
gemma-2-2b-ORPO-jpn-it-abliterated-18 (5 epoches)29.5748.0541.260.027.1836.5124.43
gemma-2-2b-ORPO-jpn-it-abliterated-18 (10 epoches)TBDTBDTBDTBDTBDTBDTBD
gemma-2-2b-jpn-it-abliterated-1730.2952.6540.460.027.1836.9024.55
gemma-2-2b-jpn-it-abliterated-1830.6153.0240.960.027.3537.3025.05
gemma-2-2b-jpn-it-abliterated-2430.6151.3740.770.027.7739.0224.73

How to run this model

py
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch

model_id = "gemma-2-2b-ORPO-jpn-it-abliterated-18"
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-ORPO-jpn-it-abliterated-18 --include "*" --local-dir ./

Credits

Thank you mlabonne for describing the ORPO fine tuning method.

Thank you FullOfBadIdeas from LocalLlama for the suggestion of using unsloth to save VRAM.