Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets: pt-sk/toxic_classification
|
4 |
+
tags: ["PPO", "RLHF"]
|
5 |
+
---
|
6 |
+
Aligning the model using Proximal Policy Optimization (PPO). The goal is to train the model to generate non-toxic reviews. The training process utilizes the `trl` library for reinforcement learning, the `transformers` library for model handling, and `datasets` for dataset management.
|
7 |
+
Implementation code is available here: [GitHub](https://github.com/sathishkumar67/GPT-2-Non-Toxic-RLHF)
|
8 |
+
```python
|
9 |
+
# Load model and tokenizer directly
|
10 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
11 |
+
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained("pt-sk/GPT2_NonToxic")
|
13 |
+
model = AutoModelForCausalLM.from_pretrained("pt-sk/GPT2_NonToxic")
|
14 |
+
|
15 |
+
# Example usage
|
16 |
+
input_text = "The movie was fantastic"
|
17 |
+
inputs = tokenizer(input_text, return_tensors='pt')
|
18 |
+
outputs = model.generate(**inputs)
|
19 |
+
|
20 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
21 |
+
```
|