Downloads · 30 days
11
11% of all-time downloads
Yuhan123/rm_cad_maj_vote_eval_acc_0_9065
rm_cad_maj_vote_eval_acc_0_9065 is a text classification model from Yuhan123. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
Reward model trained on CAD dataset with majority vote labels. Accuracy: 90.65%
Downloads · 30 days
11
11% of all-time downloads
All-time downloads
102
Public
Parameters
1.5B
28.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt11.9 GB · 50%
From the Hugging Face model README
Reward model trained on CAD dataset with majority vote labels. Accuracy: 90.65%
This is a reward model trained on the CAD (Collaborative Annotation Dataset) using TRL's RewardTrainer. The model is based on OLMo-2-0425-1B-SFT and outputs scalar reward scores for text inputs.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"Yuhan123/rm_cad_maj_vote_eval_acc_0_9065",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("Yuhan123/rm_cad_maj_vote_eval_acc_0_9065", trust_remote_code=True)
# Move to device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)
model.eval()
# Format input with chat template
text = "<|user|>\nWhat is the capital of France?\n<|assistant|>\nThe capital of France is Paris."
# Compute reward
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=1024).to(device)
with torch.no_grad():
outputs = model(**inputs, output_hidden_states=True)
# Get last hidden state
hidden_states = outputs.hidden_states[-1]
sequence_lengths = inputs.attention_mask.sum(dim=1) - 1
last_hidden = hidden_states[torch.arange(hidden_states.size(0), device=device), sequence_lengths]
# Compute reward from lm_head
reward = model.lm_head(last_hidden)[0, 0].item()
print(f"Reward score: {reward:.4f}")
<|user|> and <|assistant|> markersThe model is an AutoModelForCausalLM trained with RewardTrainer:
If you use this model, please cite the CAD dataset and TRL library:
@software{trl,
title = {TRL: Transformer Reinforcement Learning},
author = {von Werra, Leandro and Belkada, Younes and others},
year = {2020},
url = {https://github.com/huggingface/trl}
}