liamcripwell commited on
Commit
533efd4
1 Parent(s): 079aa3f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CTRL44 Simplification model
2
+
3
+ This is a pretrained version of the controllable simplification model presented in the NAACL 2022 paper "Controllable Sentence Simplification via Operation Classification". It was trained on the IRSD simplification dataset.
4
+
5
+ A control token is expected at the start of input sequences to dictate which simplification operation should be performed. This can either be done manually or with an operation classifier like [this one](https://huggingface.co/liamcripwell/ctrl44-clf).
6
+
7
+ Possible control tokens are: "\<ident\>", "\<para\>", "\<ssplit\>", and "\<dsplit\>".
8
+
9
+ ## How to use
10
+
11
+ Here is how to use this model in PyTorch:
12
+
13
+ ```python
14
+ from transformers import BartForConditionalGeneration, AutoTokenizer
15
+
16
+ model = BartForConditionalGeneration.from_pretrained("liamcripwell/ctrl44-simp")
17
+ tokenizer = AutoTokenizer.from_pretrained("liamcripwell/ctrl44-simp")
18
+
19
+ text = "<para> Barack Hussein Obama II is an American politician who served as the 44th president of the United States from 2009 to 2017."
20
+ inputs = tokenizer(text, return_tensors="pt")
21
+ outputs = model.generate(**inputs, num_beams=10, max_length=128)
22
+ ```