Upload model files
Browse files
RTO/hh-rlhf/step_40/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- trl
|
5 |
+
- ppo
|
6 |
+
- transformers
|
7 |
+
- reinforcement-learning
|
8 |
+
---
|
9 |
+
|
10 |
+
# TRL Model
|
11 |
+
|
12 |
+
This is a [TRL language model](https://github.com/huggingface/trl) that has been fine-tuned with reinforcement learning to
|
13 |
+
guide the model outputs according to a value, function, or human feedback. The model can be used for text generation.
|
14 |
+
|
15 |
+
## Usage
|
16 |
+
|
17 |
+
To use this model for inference, first install the TRL library:
|
18 |
+
|
19 |
+
```bash
|
20 |
+
python -m pip install trl
|
21 |
+
```
|
22 |
+
|
23 |
+
You can then generate text as follows:
|
24 |
+
|
25 |
+
```python
|
26 |
+
from transformers import pipeline
|
27 |
+
|
28 |
+
generator = pipeline("text-generation", model="fenguhao/models/RTO/hh-rlhf/step_40")
|
29 |
+
outputs = generator("Hello, my llama is cute")
|
30 |
+
```
|
31 |
+
|
32 |
+
If you want to use the model for training or to obtain the outputs from the value head, load the model as follows:
|
33 |
+
|
34 |
+
```python
|
35 |
+
from transformers import AutoTokenizer
|
36 |
+
from trl import AutoModelForCausalLMWithValueHead
|
37 |
+
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained("fenguhao/models/RTO/hh-rlhf/step_40")
|
39 |
+
model = AutoModelForCausalLMWithValueHead.from_pretrained("fenguhao/models/RTO/hh-rlhf/step_40")
|
40 |
+
|
41 |
+
inputs = tokenizer("Hello, my llama is cute", return_tensors="pt")
|
42 |
+
outputs = model(**inputs, labels=inputs["input_ids"])
|
43 |
+
```
|