File size: 1,961 Bytes
e97ba53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: en
license: apache-2.0
library_name: transformers.js
pipeline_tag: text2text-generation
tags:
  - grammatical-error-correction
  - text-editing
  - onnx
  - transformers.js
  - flan-t5
---

# CoEdIT Large (ONNX)

ONNX quantized version of Grammarly's CoEdIT-Large model for browser-based text editing and grammatical error correction with [Transformers.js](https://huggingface.co/docs/transformers.js).

## Original Model

- **Source**: [grammarly/coedit-large](https://huggingface.co/grammarly/coedit-large)
- **Paper**: [CoEdIT: Text Editing by Task-Specific Instruction Tuning](https://arxiv.org/abs/2305.09857) (EMNLP 2023)
- **Architecture**: Flan-T5-Large (encoder-decoder)
- **Parameters**: ~770M

## Conversion Details

- **Format**: ONNX
- **Quantization**: INT8 (dynamic quantization)
- **Size**: ~780MB
- **Converted by**: Optimum CLI

## How It Works

CoEdIT is a text-to-text model fine-tuned for various editing tasks. For grammar correction, use the prompt format:

```
Fix grammatical errors: <input text>
```

The model generates the corrected text directly.

## Usage with Transformers.js

```javascript
import { pipeline } from '@huggingface/transformers';

const corrector = await pipeline(
  'text2text-generation',
  'YOUR_USERNAME/coedit-large',
  { dtype: 'q8' }
);

const result = await corrector('Fix grammatical errors: He go to school yesterday.');
console.log(result[0].generated_text);
// "He went to school yesterday."
```

## Supported Tasks

CoEdIT supports multiple editing tasks via different prompts:

- `Fix grammatical errors: ...` - Grammar correction
- `Paraphrase: ...` - Paraphrasing
- `Simplify: ...` - Text simplification
- `Make this more formal: ...` - Formality transfer
- `Make this more coherent: ...` - Coherence improvement

## Performance

More flexible than GECToR (can rewrite sentences), but slower due to autoregressive generation.

## License

Apache 2.0 (following original model license)