Instructions to use RLHFlow/Decision-Tree-Reward-Gemma-2-27B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RLHFlow/Decision-Tree-Reward-Gemma-2-27B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="RLHFlow/Decision-Tree-Reward-Gemma-2-27B", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("RLHFlow/Decision-Tree-Reward-Gemma-2-27B", trust_remote_code=True) model = AutoModelForSequenceClassification.from_pretrained("RLHFlow/Decision-Tree-Reward-Gemma-2-27B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_decision_tree_reward_model.py
Browse files
modeling_decision_tree_reward_model.py
CHANGED
|
@@ -93,6 +93,8 @@ class Gemma2ForDecisionTreeRewardModel(Gemma2ForSequenceClassification):
|
|
| 93 |
rewards_2 = embedding_2 @ weight.T + bias
|
| 94 |
rewards_diff = rewards_2 - rewards_1
|
| 95 |
return {
|
| 96 |
-
"preference": self.tree.predict(rewards_diff)[0],
|
| 97 |
-
"
|
|
|
|
|
|
|
| 98 |
|
|
|
|
| 93 |
rewards_2 = embedding_2 @ weight.T + bias
|
| 94 |
rewards_diff = rewards_2 - rewards_1
|
| 95 |
return {
|
| 96 |
+
"preference": self.tree.predict(rewards_diff)[0],
|
| 97 |
+
"rewards": np.concatenate([rewards_1, rewards_2]),
|
| 98 |
+
"attributes": self.attributes
|
| 99 |
+
}
|
| 100 |
|