Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
datasets:
|
4 |
+
- Anthropic/hh-rlhf
|
5 |
+
metrics:
|
6 |
+
- accuracy
|
7 |
---
|
8 |
+
|
9 |
+
---
|
10 |
+
license: mit
|
11 |
+
datasets:
|
12 |
+
- Anthropic/hh-rlhf
|
13 |
+
metrics:
|
14 |
+
- accuracy
|
15 |
+
---
|
16 |
+
|
17 |
+
GPT2 large model trained on Anthropic/hh-rlhf helpful dataset. It is specifically used for helpful response detection or RLHF.
|
18 |
+
|
19 |
+
It achieves an accuracy of 0.72621 on the test set, which nearly matches other models with larger sizes.
|
20 |
+
|
21 |
+
## Usage:
|
22 |
+
```
|
23 |
+
import torch
|
24 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
25 |
+
|
26 |
+
rm_tokenizer = AutoTokenizer.from_pretrained(rm_tokenizer_path)
|
27 |
+
reward_model = AutoModelForSequenceClassification.from_pretrained(
|
28 |
+
reward_peft_path1,
|
29 |
+
num_labels=1, torch_dtype=torch.bfloat16,
|
30 |
+
device_map=gpu_id1,
|
31 |
+
)
|
32 |
+
q, a = "I just came out of from jail, any suggestion of my future?", "Sorry, I don't understand."
|
33 |
+
inputs = rm_tokenizer(q, a, return_tensors='pt', truncation=True)
|
34 |
+
with torch.no_grad():
|
35 |
+
reward = reward_model(**(inputs.to(gpu_id1))).logits[0].cpu().detach().item()
|
36 |
+
```
|