Update README.md
Browse files
README.md
CHANGED
|
@@ -44,12 +44,12 @@ def test(model_path):
|
|
| 44 |
model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
|
| 45 |
|
| 46 |
with torch.no_grad():
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
|
| 54 |
test("openbmb/Eurus-RM-7b")
|
| 55 |
# Output: 47.4404296875
|
|
|
|
| 44 |
model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
|
| 45 |
|
| 46 |
with torch.no_grad():
|
| 47 |
+
for example in dataset:
|
| 48 |
+
inputs = tokenizer(example["chosen"], return_tensors="pt")
|
| 49 |
+
chosen_reward = model(**inputs).item()
|
| 50 |
+
inputs = tokenizer(example["rejected"], return_tensors="pt")
|
| 51 |
+
rejected_reward = model(**inputs).item()
|
| 52 |
+
print(chosen_reward - rejected_reward)
|
| 53 |
|
| 54 |
test("openbmb/Eurus-RM-7b")
|
| 55 |
# Output: 47.4404296875
|