wanyu/IteraTeR-ROBERTA-Intention-Classifier
517
1---2datasets:3- IteraTeR_full_sent4---5 6# IteraTeR RoBERTa model7This 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 9Paper: [Understanding Iterative Revision from Human-Written Text](https://arxiv.org/abs/2203.03802) <br>10Authors: Wanyu Du, Vipul Raheja, Dhruv Kumar, Zae Myung Kim, Melissa Lopez, Dongyeop Kang11 12## Edit Intention Prediction Task13Given a pair of original sentence and revised sentence, our model can predict the edit intention for this revision pair.<br>14More specifically, the model will predict the probability of the following edit intentions:15<table>16 <tr>17 <th>Edit Intention</th>18 <th>Definition</th>19 <th>Example</th>20 </tr>21 <tr>22 <td>clarity</td>23 <td>Make the text more formal, concise, readable and understandable.</td>24 <td>25 Original: It's like a house which anyone can enter in it. <br>26 Revised: It's like a house which anyone can enter.27 </td>28 </tr>29 <tr>30 <td>fluency</td>31 <td>Fix grammatical errors in the text.</td>32 <td>33 Original: In the same year he became the Fellow of the Royal Society. <br>34 Revised: In the same year, he became the Fellow of the Royal Society.35 </td>36 </tr>37 <tr>38 <td>coherence</td>39 <td>Make the text more cohesive, logically linked and consistent as a whole.</td>40 <td>41 Original: Achievements and awards Among his other activities, he founded the Karachi Film Guild and Pakistan Film and TV Academy. <br>42 Revised: Among his other activities, he founded the Karachi Film Guild and Pakistan Film and TV Academy.43 </td>44 </tr>45 <tr>46 <td>style</td>47 <td>Convey the writer’s writing preferences, including emotions, tone, voice, etc..</td>48 <td>49 Original: She was last seen on 2005-10-22. <br>50 Revised: She was last seen on October 22, 2005.51 </td>52 </tr>53 <tr>54 <td>meaning-changed</td>55 <td>Update or add new information to the text.</td>56 <td>57 Original: This method improves the model accuracy from 64% to 78%. <br>58 Revised: This method improves the model accuracy from 64% to 83%.59 </td>60 </tr>61</table>62 63 64 65## Usage66```python67import torch68from transformers import AutoTokenizer, AutoModelForSequenceClassification69 70tokenizer = AutoTokenizer.from_pretrained("wanyu/IteraTeR-ROBERTA-Intention-Classifier")71model = AutoModelForSequenceClassification.from_pretrained("wanyu/IteraTeR-ROBERTA-Intention-Classifier")72 73id2label = {0: "clarity", 1: "fluency", 2: "coherence", 3: "style", 4: "meaning-changed"}74 75before_text = 'I likes coffee.'76after_text = 'I like coffee.'77model_input = tokenizer(before_text, after_text, return_tensors='pt')78model_output = model(**model_input)79softmax_scores = torch.softmax(model_output.logits, dim=-1)80pred_id = torch.argmax(softmax_scores)81pred_label = id2label[pred_id.int()]82```