File size: 3,270 Bytes
aa9baf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b92b103
 
 
 
 
 
 
 
afe332e
 
b92b103
afe332e
b92b103
 
 
 
 
aa9baf7
 
544b646
aa9baf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e32a9f
 
544b646
aa9baf7
6e32a9f
 
 
 
aa9baf7
6e32a9f
 
aa9baf7
544b646
 
 
 
 
aa9baf7
544b646
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
language:
- en

tags:
- feedback comment generation for writing learning

licenses:
- cc-by-nc-sa
---
## Model overview

This model was trained in terms of [GenChal 2022: Feedback Comment Generation for Writing Learning](https://fcg.sharedtask.org/) shared task

In this task, the model gets the string with text with the error and the exact span of the error and should return the comment in natural language, which explains the nature of the error.


## How to use

```python
!pip install feedback_generation_nigula
from feedback_generation_nigula.generator import FeedbackGenerator

fg = FeedbackGenerator(cuda_index = 0)
text_with_error = "The smoke flow my face ."
error_span = (10,17)

fg.get_feedback([text_with_error ], [error_span ]) 

# expected output ["When the <verb> <<flow>> is used as an <intransitive verb> to express'' to move in a stream'', a <preposition> needs to be placed to indicate the direction"]

```

## Model training details

#### Data

The data was provided in the following way

```
input sentence [\t] offset range [\t] feedback comment 
```

Here are some examples
```
The smoke flow my face .	10:17	When the <verb> <<flow>> is used as an <intransitive verb> to express ''to move in a stream'', a <preposition> needs to be placed to indicate the direction. 'To' and 'towards' are <prepositions> that indicate direction.

I want to stop smoking during driving bicycle .	23:29	A <gerund> does not normally follow the <preposition> <<during>>. Think of an expression using the <conjunction> 'while' instead of a <preposition>.

```

Grammar termins are highlighted with '< ... >' marks and word examples - with '<< ... >>'

####  Data preprocessing

We lowercased the text, split it from any punctuation, including task specific marks (<< >>) and explicitly pointed out the error in the original text using << >>.

```
the smoke < < flow > > < < my > > face .	10:17 When the < verb > < < flow > > is used as an < intransitive verb > to express '' to move in a stream '', a < preposition > needs to be placed to indicate the direction. ' to ' and ' towards ' are < prepositions > that indicate direction .

i want to stop smoking < < during > > driving bicycle .	23:29	a < gerund > does not normally follow the < preposition > < < during > > . think of an expression using the < conjunction > ' while ' instead of a < preposition > .
```

####  Data augmentation

The main feature of our training pipeline was data augmentation. The idea of the augmentation is as follows: we cut the existing text with error after the last word which was syntactically connected to the words inside the error span (syntactic dependencies were automatically parsed with spacy) and this cut version of the text with error was used as a prompt for language model (we used [GPT-Neo 1.3B](https://huggingface.co/EleutherAI/gpt-neo-1.3B)).

Using both initial and augmented data we fine-tuned [t5-large](https://huggingface.co/t5-large).



## Licensing Information

[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].

[![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]

[cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/
[cc-by-nc-sa-image]: https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png