Instructions to use Digsm003/safety-assign1-bert-reward-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Digsm003/safety-assign1-bert-reward-model with Transformers:
# Load model directly from transformers import AutoTokenizer, BertForReward tokenizer = AutoTokenizer.from_pretrained("Digsm003/safety-assign1-bert-reward-model") model = BertForReward.from_pretrained("Digsm003/safety-assign1-bert-reward-model") - Notebooks
- Google Colab
- Kaggle
BERT Reward Model
This model was fine-tuned on the 'Cultural Kaleidoscope' dataset to act as a Reward Model for RLHF.
It uses bert-base-uncased as the base.
Important: Custom Class Required
This model uses a custom wrapper class (BertForReward) to fix a compatibility issue between BERT (an encoder) and the RewardTrainer (which expects generative model arguments like use_cache).
You must define this class in your script before loading the model.
1. Define the Class
Copy this code into your script:
import torch
from transformers import BertForSequenceClassification
class BertForReward(BertForSequenceClassification):
def forward(self, *args, **kwargs):
kwargs.pop("use_cache", None)
return super().forward(*args, **kwargs)
- Downloads last month
- 4
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support