ATG2222 / expectedgec

huggingface.co
Total runs: 79
24-hour runs: 3
7-day runs: 74
30-day runs: 75
Model's Last Updated: May 03 2026

Introduction of expectedgec

Model Details of expectedgec

Grammar Error Correction (GEC) with T5

This notebook demonstrates how to fine-tune and use a T5-based model for Grammar Error Correction (GEC). It leverages the transformers library from Hugging Face for model handling and training.

Table of Contents
Introduction

This project focuses on building a Grammar Error Correction system using a pre-trained T5 model. GEC is the task of identifying and correcting grammatical errors in text. The notebook covers:

  1. Data Preparation : Extracting and parsing M2 format datasets.
  2. Model Loading : Loading a T5 model and tokenizer from Hugging Face.
  3. Fine-tuning : Training the T5 model on the prepared GEC dataset.
  4. Explainable AI : Implementing a custom ExplainableAIJudge to provide rationales for corrections.
  5. Evaluation : Setting up a basic evaluation framework for GEC and explanation quality.
  6. Model Export : Saving and downloading the fine-tuned model.
Dataset

The notebook uses data from two sources, primarily targeting M2 format files:

  • CoNLL-14 Shared Task Data : Used for training ( conll14st-test-data.tar.gz ).
  • WI+LOCNESS M2 Data (BEA-19) : Also used for training ( wi+locness_v2.1.bea19.tar.gz ).

The parse_m2 function extracts source sentences and their corresponding target corrections from these files. The data is then transformed into a format suitable for sequence-to-sequence models.

Model Training

The core of the GEC system is a T5 model. Specifically, it uses vennify/t5-base-grammar-correction as the base model.

GECDataset Class

A custom GECDataset class prepares the data for the T5 model, tokenizing source and target sentences and ensuring they are padded/truncated to a maximum length. Each source sentence is prefixed with "gec: " to prompt the T5 model for grammar correction.

Trainer from Hugging Face

The Trainer API from transformers is used for fine-tuning the T5 model. It handles the training loop, logging, and model saving.

Explainable AI Judge

An ExplainableAIJudge class is implemented to not only correct grammar but also provide human-readable explanations for the changes. It leverages difflib.SequenceMatcher to find differences between the original and corrected sentences and maps these differences to predefined error types with explanations.

Error Mapping

The error_map dictionary translates internal error codes (e.g., R:VERB:TENSE , R:PUNCT ) into descriptive explanations.

Evaluation

The evaluate_xgec function provides metrics for both correction performance and explanation quality:

  • Correction Metrics : Accuracy, Precision, Recall, and F0.5 score, comparing hypotheses (model's corrections) against references (ground truth).
  • Explanation Quality : BERTScore F1 for semantic similarity between generated explanations and reference explanations, and Error Type Accuracy for how well the model's identified error types match the ground truth.
Save and Download Model

After training, the fine-tuned model and tokenizer are saved to a local directory. This directory is then compressed into a gec_model.tar.gz file, which can be downloaded using google.colab.files.download for deployment or further use.

Runs of ATG2222 expectedgec on huggingface.co

79
Total runs
3
24-hour runs
19
3-day runs
74
7-day runs
75
30-day runs

More Information About expectedgec huggingface.co Model

More expectedgec license Visit here:

https://choosealicense.com/licenses/apache-2.0

expectedgec huggingface.co

expectedgec huggingface.co is an AI model on huggingface.co that provides expectedgec's model effect (), which can be used instantly with this ATG2222 expectedgec model. huggingface.co supports a free trial of the expectedgec model, and also provides paid use of the expectedgec. Support call expectedgec model through api, including Node.js, Python, http.

expectedgec huggingface.co Url

https://huggingface.co/ATG2222/expectedgec

ATG2222 expectedgec online free

expectedgec huggingface.co is an online trial and call api platform, which integrates expectedgec's modeling effects, including api services, and provides a free online trial of expectedgec, you can try expectedgec online for free by clicking the link below.

ATG2222 expectedgec online free url in huggingface.co:

https://huggingface.co/ATG2222/expectedgec

expectedgec install

expectedgec is an open source model from GitHub that offers a free installation service, and any user can find expectedgec on GitHub to install. At the same time, huggingface.co provides the effect of expectedgec install, users can directly use expectedgec installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

expectedgec install url in huggingface.co:

https://huggingface.co/ATG2222/expectedgec

Url of expectedgec

expectedgec huggingface.co Url

Provider of expectedgec huggingface.co

ATG2222
ORGANIZATIONS