proximity / readme.md
EnderAir
Upload folder using huggingface_hub
ab704d6 verified
|
Raw History Blame Contribute Delete
2.5 kB
\---
license: apache-2.0
base\_model: t5-small
tags:
  - grammar-correction
  - t5
  - text2text-generation
language:
  - en
\---
\# Proximity Grammar Corrector (T5-small)
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.
\## What this model does
Takes a sentence with grammar mistakes and outputs a corrected version. Examples:
| Input | Output |
|---|---|
| She dont like going to the store. | She doesn't like going to the store. |
| He are moving here. | He is moving here. |
| I has went to the market yesterday. | I have gone to the market yesterday. |
| They was happy about they new house. | They were happy about their new house. |
\## What this model does NOT do
\- It is \*\*not a chat model\*\*. It will not hold a conversation or answer questions.
\- It is \*\*not a style/tone rewriter\*\*. It targets grammatical correctness, not voice or wording improvements.
\- It struggles with some irregular verb forms not well represented in training data (e.g. "drinked" instead of "drank" was not corrected in testing).
\- It is trained on a small dataset (\~6,000 sentence pairs), so coverage of rare or complex grammatical errors is limited.
\## Training details
\- \*\*Base model:\*\* t5-small (\~60M parameters)
\- \*\*Dataset:\*\* \[Owishiboo/grammar-correction](https://huggingface.co/datasets/Owishiboo/grammar-correction) (\~6,000 ungrammatical → grammatical sentence pairs)
\- \*\*Epochs:\*\* 6
\- \*\*Final train loss:\*\* 0.1685
\- \*\*Final eval loss:\*\* \~0.186
\## Usage
```python
from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from\_pretrained("EnderAir/proximity")
model = T5ForConditionalGeneration.from\_pretrained("EnderAir/proximity")
text = "grammar: He are moving here."
inputs = tokenizer(text, return\_tensors="pt")
outputs = model.generate(\*\*inputs, max\_length=64, num\_beams=5)
print(tokenizer.decode(outputs\[0], skip\_special\_tokens=True))
\# "He is moving here."
```
Note: always prefix input text with `"grammar: "` — this is the T5 task prefix convention used during training.
\## License
Apache 2.0