andreaskoepf
commited on
Commit
•
7618ad7
1
Parent(s):
76077fb
minor code clarification
Browse files
README.md
CHANGED
@@ -13,14 +13,16 @@ Compute was generously provided by [Stability AI](https://stability.ai/)
|
|
13 |
### How to use
|
14 |
|
15 |
```python
|
|
|
16 |
# install open assistant model_training module (e.g. run `pip install -e .` in `model/` directory of open-assistant repository)
|
17 |
import model_training.models.reward_model # noqa: F401 (registers reward model for AutoModel loading)
|
18 |
|
|
|
19 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
20 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
21 |
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|>"
|
22 |
inputs = tokenizer(input_text, return_tensors="pt")
|
23 |
-
score =
|
24 |
print(score)
|
25 |
```
|
26 |
|
|
|
13 |
### How to use
|
14 |
|
15 |
```python
|
16 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
17 |
# install open assistant model_training module (e.g. run `pip install -e .` in `model/` directory of open-assistant repository)
|
18 |
import model_training.models.reward_model # noqa: F401 (registers reward model for AutoModel loading)
|
19 |
|
20 |
+
model_name = "OpenAssistant/oasst-rm-2-pythia-6.9b-epoch-1"
|
21 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
22 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
23 |
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|>"
|
24 |
inputs = tokenizer(input_text, return_tensors="pt")
|
25 |
+
score = model(**inputs).logits[0].cpu().detach()
|
26 |
print(score)
|
27 |
```
|
28 |
|