Downloads · 30 days
60
1% of all-time downloads
cloudyu/google-gemma-7b-it-dpo-v1
google-gemma-7b-it-dpo-v1 is a text generation model from cloudyu. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
this is a DPO fine-tuned model for google/gemma-7b-it using jondurbin/truthy-dpo-v0.1
Downloads · 30 days
60
1% of all-time downloads
All-time downloads
10.2K
Public
Parameters
8.5B
17.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors17.1 GB · 100%
From the Hugging Face model README
this is a DPO fine-tuned model for google/gemma-7b-it using jondurbin/truthy-dpo-v0.1
DPO Trainer
TRL supports the DPO Trainer for training language models from preference data, as described in the paper Direct Preference Optimization: Your Language Model is Secretly a Reward Model by Rafailov et al., 2023.
target_modules=[ "gate_proj", "up_proj", "down_proj"]
sample code
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import math
## v2 models
model_path = "cloudyu/google-gemma-7b-it-dpo-v1"
tokenizer = AutoTokenizer.from_pretrained(model_path, use_default_system_prompt=False)
model = AutoModelForCausalLM.from_pretrained(
model_path, torch_dtype=torch.bfloat16, device_map='auto',local_files_only=False, load_in_4bit=True
)
print(model)
prompt = input("please input prompt:")
while len(prompt) > 0:
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
generation_output = model.generate(
input_ids=input_ids, max_new_tokens=500,repetition_penalty=1.2
)
print(tokenizer.decode(generation_output[0]))
prompt = input("please input prompt:")