liamcripwell
commited on
Commit
•
3922f1b
1
Parent(s):
9179c2c
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# CTRL44 Classification model
|
2 |
+
|
3 |
+
This is a pretrained version of the 4-class simplification operation classifier presented in the NAACL 2022 paper "Controllable Sentence Simplification via Operation Classification". It was trained on the IRSD classification dataset.
|
4 |
+
|
5 |
+
Predictions from this model can be used for input into the [simplification model](https://huggingface.co/liamcripwell/ctrl44-simp) to reproduce pipeline results seen in the paper.
|
6 |
+
|
7 |
+
## How to use
|
8 |
+
|
9 |
+
Here is how to use this model in PyTorch:
|
10 |
+
|
11 |
+
```python
|
12 |
+
from transformers import RobertaForSequenceClassification, AutoTokenizer
|
13 |
+
|
14 |
+
model = RobertaForSequenceClassification.from_pretrained("liamcripwell/ctrl44-clf")
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained("liamcripwell/ctrl44-clf")
|
16 |
+
|
17 |
+
text = "Barack Hussein Obama II is an American politician who served as the 44th president of the United States from 2009 to 2017."
|
18 |
+
inputs = tokenizer(text, return_tensors="pt")
|
19 |
+
|
20 |
+
with torch.no_grad():
|
21 |
+
logits = model(**inputs).logits
|
22 |
+
predicted_class_id = logits.argmax().item()
|
23 |
+
predicted_class_name = model.config.id2label[predicted_class_id]
|
24 |
+
```
|