Update README.md
Browse files
README.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
datasets:
|
4 |
-
tags:
|
5 |
-
- PPO
|
6 |
-
- RLHF
|
7 |
-
pipeline_tag: text-generation
|
8 |
-
---
|
9 |
-
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.
|
10 |
-
Implementation code is available here: [GitHub](https://github.com/sathishkumar67/GPT-2-Non-Toxic-RLHF)
|
11 |
-
```python
|
12 |
-
# Load model and tokenizer directly
|
13 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
14 |
-
|
15 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
16 |
-
model = AutoModelForCausalLM.from_pretrained("
|
17 |
-
|
18 |
-
# Example usage
|
19 |
-
input_text = "The movie was fantastic"
|
20 |
-
inputs = tokenizer(input_text, return_tensors='pt')
|
21 |
-
outputs = model.generate(**inputs)
|
22 |
-
|
23 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
24 |
```
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
datasets: Kwaai/toxic_classification
|
4 |
+
tags:
|
5 |
+
- PPO
|
6 |
+
- RLHF
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
---
|
9 |
+
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.
|
10 |
+
Implementation code is available here: [GitHub](https://github.com/sathishkumar67/GPT-2-Non-Toxic-RLHF)
|
11 |
+
```python
|
12 |
+
# Load model and tokenizer directly
|
13 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
14 |
+
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained("Kwaai/GPT2_NonToxic")
|
16 |
+
model = AutoModelForCausalLM.from_pretrained("Kwaai/GPT2_NonToxic")
|
17 |
+
|
18 |
+
# Example usage
|
19 |
+
input_text = "The movie was fantastic"
|
20 |
+
inputs = tokenizer(input_text, return_tensors='pt')
|
21 |
+
outputs = model.generate(**inputs)
|
22 |
+
|
23 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
24 |
```
|