Downloads · 30 days
7
12% of all-time downloads
the-hir0/pegasus-detoxify
pegasus-detoxify is a machine learning model from the-hir0. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Text Detoxification Task is a process of transforming the text with toxic style into the text with the same meaning but with neutral style
Downloads · 30 days
7
12% of all-time downloads
All-time downloads
58
Public
Repo size
4.6 GB
Likes
0
Public
Click a slice to open those files.
.bin2.3 GB · 100%
From the Hugging Face model README
Text Detoxification Task is a process of transforming the text with toxic style into the text with the same meaning but with neutral style
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
device = 'cuda' if torch.cuda.is_available() else 'cpu'
tokenizer = AutoTokenizer.from_pretrained("the-hir0/pegasus-detoxify")
model = AutoModelForSeq2SeqLM.from_pretrained("the-hir0/pegasus-detoxify").to(device)
input_ids = tokenizer(inference_request, return_tensors="pt", padding=True).input_ids.to(device)
outputs = model.generate(input_ids=input_ids)
tokenizer.batch_decode(outputs, skip_special_tokens=True,temperature=0)