from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
model_path = "reciprocate/rm-beluga-7b-hh-full"
model = AutoModelForSequenceClassification.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
# for SequenceClassification models padding side should be "right"
tokenizer.padding_side = "right"
tokenizer.truncation_side = "left"
reward_fn = pipeline("text-classification", model=model, tokenizer=tokenizer, truncation=True, batch_size=32, max_length=2048, device=0)
output = reward_fn(["### User: Complete this sentence: I'm 99 percent sure it was someone being an...\n\n### Assistant:\n I'm 99 percent sure it was someone being an idiot.</s>"])
scores = [x["score"] for x in output]
scores
>>> [0.02713249810039997]
# optionally normalize with mean, std computed on training data
scores = (np.array(scores) - 0.6816716283619826) / 0.3198637874065531
- Downloads last month
- 7
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.