the-hir0 commited on
Commit
1f795b7
1 Parent(s): 69c3e3c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -0
README.md CHANGED
@@ -2,3 +2,15 @@
2
  license: apache-2.0
3
  ---
4
  Text Detoxification Task is a process of transforming the text with toxic style into the text with the same meaning but with neutral style
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  ---
4
  Text Detoxification Task is a process of transforming the text with toxic style into the text with the same meaning but with neutral style
5
+
6
+ # Load model directly
7
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
8
+
9
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
10
+
11
+ tokenizer = AutoTokenizer.from_pretrained("the-hir0/t5-small-detoxify")
12
+ model = AutoModelForSeq2SeqLM.from_pretrained("the-hir0/t5-small-detoxify").to(device)
13
+
14
+ input_ids = tokenizer(inference_request, return_tensors="pt", padding=True).input_ids.to(device)
15
+ outputs = model.generate(input_ids=input_ids)
16
+ return tokenizer.batch_decode(outputs, skip_special_tokens=True,temperature=0)