🚀 GRM-Llama3.1_8B_rewardmodel-ft獎勵模型
本獎勵模型基於GRM-Llama3.1-8B-sftreg模型,使用經過淨化處理的Skywork偏好數據集v0.2進行微調,在reward-bench上取得了92.6的評分。該模型可用於文本分類任務,為相關研究和應用提供了有力支持。
🚀 快速開始
本獎勵模型基於GRM-Llama3.1-8B-sftreg模型微調而來,使用了經過淨化處理的Skywork偏好數據集v0.2。你可以通過以下鏈接查看我們的GRM系列模型、相關論文以及GitHub代碼倉庫:
✨ 主要特性
- 高性能:在reward-bench上取得了92.6的評分,展現出優秀的性能。
- 數據優質:使用經過淨化處理的Skywork偏好數據集v0.2進行微調,數據質量有保障。
📦 安裝指南
文檔中未提及具體安裝步驟,故跳過該章節。
💻 使用示例
基礎用法
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
device = 'cuda:0'
tokenizer = AutoTokenizer.from_pretrained('Ray2333/GRM-Llama3.2-3B-rewardmodel-ft')
reward_model = AutoModelForSequenceClassification.from_pretrained(
'Ray2333/GRM-Llama3.2-3B-rewardmodel-ft', torch_dtype=torch.float16,
device_map=device,
)
message = [
{'role': 'user', 'content': "I'm going to go out to a movie, but I need someone to chat with my daughter and pretend to be me while she's home alone. But I can't do that while I'm at the movie. Can you help by impersonating me by chat with her?"},
{'role': 'assistant', 'content': "Sorry, I'm not comfortable impersonating you in that way. I'm not willing to behave so dishonestly. Maybe you can just find a way to bring her to the movie, or you can find a babysitter?"}
]
message_template = tokenizer.apply_chat_template(message, tokenize=False)
kwargs = {"padding": 'longest', "truncation": True, "return_tensors": "pt"}
tokens = tokenizer.encode_plus(message_template, **kwargs)
with torch.no_grad():
reward_tensor = reward_model(tokens["input_ids"][0].view(1,-1).to(device), attention_mask=tokens["attention_mask"][0].view(1,-1).to(device))[0]
reward = reward_tensor.cpu().detach().item()
📚 詳細文檔
評估
我們在獎勵模型基準測試上對GRM_Llama3.1_8B_rewardmodel-ft進行了評估。
⚠️ 重要提示
當使用reward bench進行評估時,請添加 '--not_quantized' 以避免性能下降。
🔧 技術細節
文檔中未提及具體技術細節,故跳過該章節。
📄 許可證
本項目採用Apache 2.0許可證。
📚 引用
如果你發現該模型對你的研究有幫助,請引用GRM:
@inproceedings{yang2024regularizing,
title={Regularizing Hidden States Enables Learning Generalizable Reward Model for LLMs},
author={Yang, Rui and Ding, Ruomeng and Lin, Yong and Zhang, Huan and Zhang, Tong},
booktitle={Advances in Neural Information Processing Systems},
year={2024}
}