EnderAir commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
base_model: t5-small
|
| 4 |
+
tags:
|
| 5 |
+
- grammar-correction
|
| 6 |
+
- t5
|
| 7 |
+
- text2text-generation
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
# Proximity Grammar Corrector (T5-small)
|
| 13 |
+
|
| 14 |
+
A small fine-tuned [T5-small](https://huggingface.co/t5-small) model for **English grammar correction**. Part of the [Proximity](https://github.com/) project — a lightweight background tool that fixes grammar via a global hotkey.
|
| 15 |
+
|
| 16 |
+
## What this model does
|
| 17 |
+
|
| 18 |
+
Takes a sentence with grammar mistakes and outputs a corrected version. Examples:
|
| 19 |
+
|
| 20 |
+
| Input | Output |
|
| 21 |
+
|---|---|
|
| 22 |
+
| She dont like going to the store. | She doesn't like going to the store. |
|
| 23 |
+
| He are moving here. | He is moving here. |
|
| 24 |
+
| I has went to the market yesterday. | I have gone to the market yesterday. |
|
| 25 |
+
| They was happy about they new house. | They were happy about their new house. |
|
| 26 |
+
|
| 27 |
+
## What this model does NOT do
|
| 28 |
+
|
| 29 |
+
- It is **not a chat model**. It will not hold a conversation or answer questions.
|
| 30 |
+
- It is **not a style/tone rewriter**. It targets grammatical correctness, not voice or wording improvements.
|
| 31 |
+
- It struggles with some irregular verb forms not well represented in training data (e.g. "drinked" instead of "drank" was not corrected in testing).
|
| 32 |
+
- It is trained on a small dataset (~6,000 sentence pairs), so coverage of rare or complex grammatical errors is limited.
|
| 33 |
+
|
| 34 |
+
## Training details
|
| 35 |
+
|
| 36 |
+
- **Base model:** t5-small (~60M parameters)
|
| 37 |
+
- **Dataset:** [Owishiboo/grammar-correction](https://huggingface.co/datasets/Owishiboo/grammar-correction) (~6,000 ungrammatical → grammatical sentence pairs)
|
| 38 |
+
- **Epochs:** 6
|
| 39 |
+
- **Final train loss:** 0.1685
|
| 40 |
+
- **Final eval loss:** ~0.186
|
| 41 |
+
|
| 42 |
+
## Usage
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
| 46 |
+
|
| 47 |
+
tokenizer = T5Tokenizer.from_pretrained("EnderAir/proximity")
|
| 48 |
+
model = T5ForConditionalGeneration.from_pretrained("EnderAir/proximity")
|
| 49 |
+
|
| 50 |
+
text = "grammar: He are moving here."
|
| 51 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 52 |
+
outputs = model.generate(**inputs, max_length=64, num_beams=5)
|
| 53 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 54 |
+
# "He is moving here."
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
Note: always prefix input text with `"grammar: "` — this is the T5 task prefix convention used during training.
|
| 58 |
+
|
| 59 |
+
## License
|
| 60 |
+
|
| 61 |
+
Apache 2.0
|