|
--- |
|
language: en |
|
--- |
|
|
|
# CTRL44 Classification model |
|
|
|
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. |
|
|
|
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. |
|
|
|
## How to use |
|
|
|
Here is how to use this model in PyTorch: |
|
|
|
```python |
|
from transformers import RobertaForSequenceClassification, AutoTokenizer |
|
|
|
model = RobertaForSequenceClassification.from_pretrained("liamcripwell/ctrl44-clf") |
|
tokenizer = AutoTokenizer.from_pretrained("liamcripwell/ctrl44-clf") |
|
|
|
text = "Barack Hussein Obama II is an American politician who served as the 44th president of the United States from 2009 to 2017." |
|
inputs = tokenizer(text, return_tensors="pt") |
|
|
|
with torch.no_grad(): |
|
logits = model(**inputs).logits |
|
predicted_class_id = logits.argmax().item() |
|
predicted_class_name = model.config.id2label[predicted_class_id] |
|
``` |