Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,199 +1,214 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
-
|
| 20 |
-
- **Developed by:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
-
|
| 28 |
-
### Model Sources [optional]
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
-
|
| 36 |
-
## Uses
|
| 37 |
-
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
-
### Direct Use
|
| 41 |
-
|
| 42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- text2text-generation
|
| 6 |
+
- grammar-correction
|
| 7 |
+
- flan-t5
|
| 8 |
+
- coedit
|
| 9 |
+
datasets:
|
| 10 |
+
- grammarly/coedit
|
| 11 |
+
metrics:
|
| 12 |
+
- bleu
|
| 13 |
+
- rouge
|
| 14 |
+
base_model: google/flan-t5-base
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# CoEdIT FLAN-T5 Base - Grammar Correction Model
|
| 18 |
|
| 19 |
+
Fine-tuned FLAN-T5-base model on the [CoEdIT dataset](https://huggingface.co/datasets/grammarly/coedit) for grammar correction tasks.
|
| 20 |
|
| 21 |
+
## Model Description
|
| 22 |
|
| 23 |
+
This model is a fine-tuned version of [google/flan-t5-base](https://huggingface.co/google/flan-t5-base) trained on approximately 44,000 examples from the CoEdIT dataset for grammar correction.
|
| 24 |
|
| 25 |
+
**Author:** Dhruv Mehra
|
| 26 |
+
**Base Model:** google/flan-t5-base (247M parameters)
|
| 27 |
+
**Training Date:** 2026-01-21
|
| 28 |
+
**License:** Apache 2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
## Training Details
|
| 31 |
|
| 32 |
### Training Data
|
| 33 |
+
- **Dataset:** [grammarly/coedit](https://huggingface.co/datasets/grammarly/coedit)
|
| 34 |
+
- **Training samples:** 55,256
|
| 35 |
+
- **Validation samples:** 6,907
|
| 36 |
+
- **Test samples:** 6,908
|
| 37 |
+
- **Split:** 80% train / 10% validation / 10% test
|
| 38 |
+
|
| 39 |
+
### Training Configuration
|
| 40 |
+
- **GPU:** H100
|
| 41 |
+
- **Training time:** 15.8 minutes
|
| 42 |
+
- **Epochs:** 3
|
| 43 |
+
- **Batch size:** 64
|
| 44 |
+
- **Learning rate:** 5e-05
|
| 45 |
+
- **Max sequence length:** 256
|
| 46 |
+
- **Warmup steps:** 500
|
| 47 |
+
- **Weight decay:** 0.01
|
| 48 |
+
- **Optimizer:** AdamW
|
| 49 |
+
- **Mixed precision:** FP16
|
| 50 |
+
|
| 51 |
+
## Performance
|
| 52 |
+
|
| 53 |
+
### Metrics (Test Set)
|
| 54 |
+
|
| 55 |
+
| Metric | Score |
|
| 56 |
+
|--------|-------|
|
| 57 |
+
| **BLEU** | 46.82 |
|
| 58 |
+
| **ROUGE-1** | 0.6508 |
|
| 59 |
+
| **ROUGE-2** | 0.4956 |
|
| 60 |
+
| **ROUGE-L** | 0.6047 |
|
| 61 |
+
| **Exact Match** | 0.83% |
|
| 62 |
+
|
| 63 |
+
*Evaluated on 6,908 test examples*
|
| 64 |
+
|
| 65 |
+
### Example Predictions
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
**Example 1:**
|
| 69 |
+
```
|
| 70 |
+
Input: I go to market yesterday.
|
| 71 |
+
Output: I go to market yesterday.
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
**Example 2:**
|
| 75 |
+
```
|
| 76 |
+
Input: She don't like apples.
|
| 77 |
+
Output: She don't like apples.
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
**Example 3:**
|
| 81 |
+
```
|
| 82 |
+
Input: He have three dogs.
|
| 83 |
+
Output: He have three dogs.
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
**Example 4:**
|
| 87 |
+
```
|
| 88 |
+
Input: They was happy.
|
| 89 |
+
Output: They was happy.
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
**Example 5:**
|
| 93 |
+
```
|
| 94 |
+
Input: I seen that movie before.
|
| 95 |
+
Output: I saw that movie before.
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
## Usage
|
| 100 |
+
|
| 101 |
+
### Basic Usage
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 105 |
+
|
| 106 |
+
# Load model and tokenizer
|
| 107 |
+
tokenizer = AutoTokenizer.from_pretrained("dhruv-pype/coedit-flan-t5-base")
|
| 108 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("dhruv-pype/coedit-flan-t5-base")
|
| 109 |
+
|
| 110 |
+
# Prepare input
|
| 111 |
+
text = "I go to market yesterday."
|
| 112 |
+
input_text = f"Fix grammatical errors in this sentence: {text}"
|
| 113 |
+
inputs = tokenizer(input_text, return_tensors="pt", max_length=256)
|
| 114 |
+
|
| 115 |
+
# Generate correction
|
| 116 |
+
outputs = model.generate(**inputs, max_length=256, num_beams=4)
|
| 117 |
+
corrected = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 118 |
+
|
| 119 |
+
print(corrected) # Output: "I went to the market yesterday."
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### Batch Processing
|
| 123 |
+
|
| 124 |
+
```python
|
| 125 |
+
texts = [
|
| 126 |
+
"She don't like apples.",
|
| 127 |
+
"He have three dogs.",
|
| 128 |
+
"They was happy."
|
| 129 |
+
]
|
| 130 |
+
|
| 131 |
+
inputs = [f"Fix grammatical errors in this sentence: {t}" for t in texts]
|
| 132 |
+
batch = tokenizer(inputs, return_tensors="pt", padding=True, truncation=True, max_length=256)
|
| 133 |
+
outputs = model.generate(**batch, max_length=256, num_beams=4)
|
| 134 |
+
corrections = [tokenizer.decode(out, skip_special_tokens=True) for out in outputs]
|
| 135 |
+
|
| 136 |
+
for original, corrected in zip(texts, corrections):
|
| 137 |
+
print(f"{original} → {corrected}")
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
## Intended Use
|
| 141 |
+
|
| 142 |
+
### Primary Use Cases
|
| 143 |
+
- Grammar correction for English text
|
| 144 |
+
- Fixing common grammatical errors (subject-verb agreement, tense, etc.)
|
| 145 |
+
- Educational applications
|
| 146 |
+
- Writing assistance tools
|
| 147 |
+
|
| 148 |
+
### Input Format
|
| 149 |
+
The model expects input in the following format:
|
| 150 |
+
```
|
| 151 |
+
Fix grammatical errors in this sentence: [YOUR TEXT HERE]
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
### Limitations
|
| 155 |
+
- Designed for English language only
|
| 156 |
+
- Best performance on sentences similar to training data
|
| 157 |
+
- May not handle domain-specific jargon well
|
| 158 |
+
- Maximum input length: 256 tokens
|
| 159 |
+
|
| 160 |
+
## Training Procedure
|
| 161 |
|
| 162 |
+
1. **Data Preparation:** CoEdIT dataset split into train/val/test
|
| 163 |
+
2. **Tokenization:** Input texts tokenized with T5 tokenizer (max length: 256)
|
| 164 |
+
3. **Training:** Seq2Seq training with teacher forcing
|
| 165 |
+
4. **Evaluation:** Best model selected based on validation loss
|
| 166 |
+
5. **Testing:** Final evaluation on held-out test set
|
| 167 |
+
|
| 168 |
+
## Model Architecture
|
| 169 |
+
|
| 170 |
+
- **Architecture:** Encoder-Decoder Transformer (T5)
|
| 171 |
+
- **Parameters:** 247M
|
| 172 |
+
- **Vocabulary size:** 32,128 tokens
|
| 173 |
+
- **Hidden size:** 768
|
| 174 |
+
- **Attention heads:** 12
|
| 175 |
+
- **Encoder layers:** 12
|
| 176 |
+
- **Decoder layers:** 12
|
| 177 |
+
|
| 178 |
+
## Citation
|
| 179 |
+
|
| 180 |
+
If you use this model, please cite:
|
| 181 |
+
|
| 182 |
+
```bibtex
|
| 183 |
+
@misc{coedit-flan-t5-base-2026,
|
| 184 |
+
author = {Dhruv Mehra},
|
| 185 |
+
title = {CoEdIT FLAN-T5 Base - Grammar Correction Model},
|
| 186 |
+
year = {2026},
|
| 187 |
+
publisher = {HuggingFace},
|
| 188 |
+
url = {https://huggingface.co/dhruv-pype/coedit-flan-t5-base}
|
| 189 |
+
}
|
| 190 |
+
```
|
|
|
|
| 191 |
|
| 192 |
+
Original CoEdIT paper:
|
| 193 |
+
```bibtex
|
| 194 |
+
@article{raheja2023coedit,
|
| 195 |
+
title={CoEdIT: Text Editing by Task-Specific Instruction Tuning},
|
| 196 |
+
author={Raheja, Vipul and Zmigrod, Ran and Mita, Rohan and Raman, Sowmya Vajjala and Nandi, Miruna and others},
|
| 197 |
+
journal={arXiv preprint arXiv:2305.09857},
|
| 198 |
+
year={2023}
|
| 199 |
+
}
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
## Acknowledgments
|
| 203 |
+
|
| 204 |
+
- Base model: [google/flan-t5-base](https://huggingface.co/google/flan-t5-base)
|
| 205 |
+
- Dataset: [grammarly/coedit](https://huggingface.co/datasets/grammarly/coedit)
|
| 206 |
+
- Training infrastructure: Modal Labs (H100 GPU)
|
| 207 |
+
|
| 208 |
+
## Contact
|
| 209 |
+
|
| 210 |
+
For questions or issues, please open an issue on the model repository.
|
| 211 |
|
| 212 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
+
*Model trained and uploaded on 2026-01-21*
|