andreaskoepf
commited on
Commit
•
d52b99a
1
Parent(s):
442d8d5
Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,22 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
wandb: https://wandb.ai/open-assistant/reward-model/runs/hdp2gnko
|
5 |
checkpoint-10000
|
6 |
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
+
How to use:
|
5 |
+
|
6 |
+
```python
|
7 |
+
# install open assistant model_training module (e.g. run `pip install -e .` in `model/` directory of open-assistant repository)
|
8 |
+
import model_training.models.reward_model # noqa: F401 (registers reward model for AutoModel loading)
|
9 |
+
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
11 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
12 |
+
input_text = "<|prompter|>Hi how are you?<|endoftext|><|assistant|>Hi, I am Open-Assistant a large open-source language model trained by LAION AI. How can I help you today?<|endoftext|>"
|
13 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
14 |
+
score = rm(**inputs).logits[0].cpu().detach()
|
15 |
+
print(score)
|
16 |
+
```
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
wandb: https://wandb.ai/open-assistant/reward-model/runs/hdp2gnko
|
21 |
checkpoint-10000
|
22 |
|