Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- grammar
|
| 5 |
+
- text2text-generation
|
| 6 |
+
license: cc-by-nc-sa-4.0
|
| 7 |
+
datasets:
|
| 8 |
+
- jfleg
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# T5 Grammar Correction
|
| 12 |
+
|
| 13 |
+
This model generates a revised version of inputted text with the goal of containing fewer grammatical errors.
|
| 14 |
+
It was trained with [Happy Transformer](https://github.com/EricFillion/happy-transformer)
|
| 15 |
+
using a dataset called [JFLEG](https://arxiv.org/abs/1702.04066). Here's a [full article](https://www.vennify.ai/fine-tune-grammar-correction/) on how to train a similar model.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
## Usage
|
| 19 |
+
|
| 20 |
+
`pip install happytransformer `
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
from happytransformer import HappyTextToText, TTSettings
|
| 24 |
+
|
| 25 |
+
happy_tt = HappyTextToText("T5", "vennify/t5-base-grammar-correction")
|
| 26 |
+
|
| 27 |
+
args = TTSettings(num_beams=5, min_length=1)
|
| 28 |
+
|
| 29 |
+
# Add the prefix "grammar: " before each input
|
| 30 |
+
result = happy_tt.generate_text("grammar: This sentences has has bads grammar.", args=args)
|
| 31 |
+
|
| 32 |
+
print(result.text) # This sentence has bad grammar.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
```
|