Overview
Gemma2-9B-IT-Simpo-Infinity-Preference is based on gemma-2-9b-it and finetuned on Infinity-Preference with Simpo. It achieves 73.4% LC win-rate on AlpacaEval 2.0 and 58.1% win-rate on Arena-Hard against GPT-4.
Training hyperparameters
beta: 10
gamma_beta_ratio: 1
learning_rate: 8.0e-7
log_level: info
logging_steps: 5
max_length: 2048
max_prompt_length: 1800
num_train_epochs: 1
batch_size: 128
How to Use
Gemma2-9B-IT-Simpo-Infinity-Preference adopt the same chat template of gemma-2-9b-it:
<bos><start_of_turn>user
How are you?<end_of_turn>
<start_of_turn>model
Hi!<end_of_turn>
To apply this model and template in conversation scenarios, you can refer to the following code:
from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
import torch
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained("BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference",
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference")
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
logits_processor = LogitsProcessorList(
[
MinLengthLogitsProcessor(1, eos_token_id=tokenizer.eos_token_id),
TemperatureLogitsWarper(0.8),
]
)
generated_ids = model.generate(
model_inputs.input_ids,
logits_processor=logits_processor,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
Disclaimer
The resources, including code, data, and model weights, associated with this project are restricted for academic research purposes only and cannot be used for commercial purposes. The content produced by any version of Infinity-Preference is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.
- Downloads last month
- 2,536
Model tree for BAAI/Gemma2-9B-IT-Simpo-Infinity-Preference
Base model
google/gemma-2-9b