Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- IteraTeR_full_sent
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# IteraTeR RoBERTa model
|
| 7 |
+
This model was obtained by fine-tuning [roberta-large](https://huggingface.co/roberta-large) on [IteraTeR-human-sent](https://huggingface.co/datasets/wanyu/IteraTeR_human_sent) dataset.
|
| 8 |
+
|
| 9 |
+
Paper: [Understanding Iterative Revision from Human-Written Text](https://arxiv.org/abs/2203.03802) <br>
|
| 10 |
+
Authors: Wanyu Du, Vipul Raheja, Dhruv Kumar, Zae Myung Kim, Melissa Lopez, Dongyeop Kang
|
| 11 |
+
|
| 12 |
+
## Usage
|
| 13 |
+
```python
|
| 14 |
+
import torch
|
| 15 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 16 |
+
|
| 17 |
+
tokenizer = AutoTokenizer.from_pretrained("wanyu/IteraTeR-ROBERTA")
|
| 18 |
+
model = AutoModelForSequenceClassification.from_pretrained("wanyu/IteraTeR-ROBERTA")
|
| 19 |
+
|
| 20 |
+
id2label = {0: "clarity", 1: "fluency", 2: "coherence", 3: "style", 4: "meaning-changed"}
|
| 21 |
+
|
| 22 |
+
before_text = 'I likes coffee.'
|
| 23 |
+
after_text = 'I like coffee.'
|
| 24 |
+
model_input = tokenizer(before_text, after_text, return_tensors='pt')
|
| 25 |
+
model_output = model(**model_input)
|
| 26 |
+
softmax_scores = torch.softmax(model_output.logits, dim=-1)
|
| 27 |
+
pred_id = torch.argmax(softmax_scores)
|
| 28 |
+
pred_label = id2label[pred_id.int()]
|
| 29 |
+
```
|