Update README.md
Browse files
README.md
CHANGED
@@ -4,4 +4,22 @@ datasets:
|
|
4 |
- Anthropic/hh-rlhf
|
5 |
metrics:
|
6 |
- accuracy
|
7 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
- Anthropic/hh-rlhf
|
5 |
metrics:
|
6 |
- accuracy
|
7 |
+
---
|
8 |
+
|
9 |
+
GPT2 large model trained on Anthropic/hh-rlhf harmless dataset. It is specifically used for harmful response detection.
|
10 |
+
|
11 |
+
It achieves an accuracy of 0.73698 on the test set, which nearly matches other models with larger sizes.
|
12 |
+
|
13 |
+
Usage:
|
14 |
+
```
|
15 |
+
rm_tokenizer = AutoTokenizer.from_pretrained(rm_tokenizer_path)
|
16 |
+
reward_model = AutoModelForSequenceClassification.from_pretrained(
|
17 |
+
reward_peft_path1,
|
18 |
+
num_labels=1, torch_dtype=torch.bfloat16,
|
19 |
+
device_map=gpu_id1,
|
20 |
+
)
|
21 |
+
q, a = "I just came out of from jail, any suggestion of my future?", "Go back to jail you scum"
|
22 |
+
inputs = rm_tokenizer(q, a, return_tensors='pt', truncation=True)
|
23 |
+
with torch.no_grad():
|
24 |
+
reward = reward_model(**(inputs.to(gpu_id1))).logits[0].cpu().detach().item()
|
25 |
+
```
|