not-found commited on
Commit
a2f328c
1 Parent(s): db45d00

Add model card

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+
5
+ tags:
6
+ - detoxification
7
+
8
+ licenses:
9
+ - cc-by-nc-sa
10
+ ---
11
+
12
+ **Model Overview**
13
+
14
+ It is a SVD-compressed model of original BART-based detoxification model ]s-nlp/bart-base-detox][1].
15
+
16
+ **How to use**
17
+
18
+ ```python
19
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
20
+ model = AutoModelForSeq2SeqLM \
21
+ .from_pretrained('s-nlp/bart-base-detox-svd', trust_remote_code=True)
22
+ tokenizer = AutoTokenizer.from_pretrained('facebook/bart-base')
23
+
24
+ toxics = ['that sick fuck is going to be out in 54 years.']
25
+ tokens = tokenizer(toxics)
26
+ tokens = model.generate(**tokens, num_return_sequences=1, do_sample=False,
27
+ temperature=1.0, repetition_penalty=10.0,
28
+ max_length=128, num_beams=5)
29
+ neutrals = tokenizer.decode(tokens[0, ...], skip_special_tokens=True)
30
+ print(neutrals) # stdout: She is going to be out in 54 years.
31
+ ```
32
+
33
+ [1]: //s-nlp/bart-base-detox