Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- Dahoas/rm-static
|
4 |
+
- openai/webgpt_comparisons
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
---
|
8 |
+
## Inference Example:
|
9 |
+
|
10 |
+
```python
|
11 |
+
from peft import PeftModel, PeftConfig
|
12 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
13 |
+
|
14 |
+
peft_model_id = "edu-linguistic/deberta-v3-large-edu-rm"
|
15 |
+
model_name = 'microsoft/deberta-v3-large'
|
16 |
+
|
17 |
+
config = PeftConfig.from_pretrained(peft_model_id)
|
18 |
+
model_config = AutoConfig.from_pretrained(model_name, cache_dir=self.model_cache_dir)
|
19 |
+
model_config.num_labels = 1
|
20 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
21 |
+
model = PeftModelForSequenceClassification.from_pretrained(model, peft_model_id)
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
+
|
24 |
+
texts = "<|prompter|> When using linear regression, how do you help prevent numerical instabilities? (One or multiple answers) \n <|assistant|> 4. add more features"
|
25 |
+
|
26 |
+
inputs = tokenizer(texts, return_tensors='pt', padding=True, truncation=True)
|
27 |
+
score = self.reward_model(**inputs).logits.cpu().detach()
|
28 |
+
|
29 |
+
print(score)
|
30 |
+
```
|