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. Implementation code is available here: GitHub

# Load model and tokenizer directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("Kwaai/GPT2_NonToxic")
model = AutoModelForCausalLM.from_pretrained("Kwaai/GPT2_NonToxic")

# Example usage
input_text = "you are toxic!"
inputs = tokenizer(input_text, return_tensors='pt')
outputs = model.generate(**inputs)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Downloads last month
2
Safetensors
Model size
124M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported third-party Inference Providers, and the model is not deployed on the HF Inference API.

Dataset used to train Kwaai/GPT2_NonToxic