Instructions to use itzune/gector-eus-v5-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use itzune/gector-eus-v5-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('token-classification', 'itzune/gector-eus-v5-onnx');
GECToR v5 ONNX β in-browser Basque Grammatical Error Correction
int4-quantized ONNX build of itzune/gector-eus-v5
for ONNX Runtime Web (WASM), Transformers.js, or plain onnxruntime on CPU.
89 MB download, ~50 ms per sentence on a single CPU thread, no GPU or
WebGPU required. Used by txukun to give
in-browser Basque corrections with an error type per edited word.
Model details
| Base checkpoint | itzune/gector-eus-v5 (fp32, 488 MB) |
| Architecture | GECToR Β· RoBERTa-eus-base encoder + edit/detect/type heads |
| Quantization | dynamic int4 (model_q4.onnx), int8 fallback (model_quantized.onnx) |
| Input | input_ids, attention_mask, token_type_ids (int64, shape [batch, β€128]) |
| Outputs | logits (edit labels, 3,501), logits_d (error detection), logits_t (error type) |
| Decode | up to 5 iterations, verbs resolved through a Basque verb-form dictionary |
Files
| file | size | purpose |
|---|---|---|
onnx/model_q4.onnx |
86 MB | int4 weights β the browser bundle |
model_quantized.onnx |
127 MB | int8 weights β slightly better, larger |
gector_vocab.json |
218 KB | label maps, keep/incorrect ids, max_length |
tokenizer/ |
4.8 MB | SentencePiece + fast-tokenizer files ($START preserved) |
$START is a single token in this tokenizer, matching the browser-side
tokenizer used by txukun; do not re-tokenize with a generic XLMRoberta config.
Usage
import json, onnxruntime as ort
from transformers import AutoTokenizer
bundle = "itzune/gector-eus-v5-onnx"
tok = AutoTokenizer.from_pretrained(f"{bundle}/tokenizer", add_prefix_space=True)
vocab = json.load(open(f"{bundle}/gector_vocab.json"))
id2label = {int(k): v for k, v in vocab["id2label"].items()}
sess = ort.InferenceSession(f"{bundle}/onnx/model_q4.onnx",
providers=["CPUExecutionProvider"])
ids = tok("$START " + "Hitz hau gaizki idatzi da .")["input_ids"]
logits, detect, etype = sess.run(None, {
"input_ids": [ids],
"attention_mask": [[1] * len(ids)],
"token_type_ids": [[0] * len(ids)],
})
# edit labels β keep / replace / delete / append edits; repeat up to 5 iterations.
The decode loop, spelling cascade and evaluation harness live in
itzune/gector-eus-v2:
scripts/gector_onnx.py, scripts/spell_cascade.py, scripts/eval_onnx.py.
In the browser, load model_q4.onnx + tokenizer/ with
Transformers.js
(pipeline("token-classification", ...)) or onnxruntime-web directly.
Results
int4 ONNX, CPU, min_error_prob = 0.5.
| slice | v4.1 exact | v5 exact | v4.1 F0.5 | v5 F0.5 |
|---|---|---|---|---|
| standard synthetic (1,037) | 53.1% | 55.4% | 77.7 | 79.0 |
| real multi-error (826) | 42.6% | 43.2% | 82.2 | 81.7 |
| held-out paradigm pairs (300) | 34.7% | 36.3% | 53.4 | 57.5 |
| real Wikipedia (171, hand-checked) | 8.2%* | 13.5% | 25.2* | 43.7 |
* v4.1 row includes the hunspell cascade; v5 without it already scores higher.
Clean-text false positives: 2.2% (shotgun) / 1.6% at min_error_prob 0.6, and
0.8% on the real Wikipedia clean half. Size/speed: 89 MB, ~49 ms/sentence
(4-core CPU, batch 64).
Limitations
- Bounded by a 3,501-label edit vocabulary: unseen misspellings are detected but not corrected without the hunspell cascade.
- Syntax-level rewrites, word reordering and discourse-level rewrites are out of scope β this is a minimal-edit model.
- Trained on edited Basque prose (news, encyclopedic, gazettes) + Wikipedia; other registers are untested.
- WASM builds are single-threaded unless cross-origin isolation is configured; expect 100β200 ms/sentence there.
Licensing
Weights: CC-BY-NC-SA-4.0 β inherited from the CC-BY-NC-4.0 encoder
(ixa-ehu/roberta-eus-euscrawl-base-cased) and the CC-BY-SA-4.0 training data.
Non-commercial use only. The itzune/gector-eus-v2-onnx card states CC-BY-SA-4.0;
that predates this licence review and is being corrected.
Citation
@misc{ezpeleta2026gectoreusv5onnx,
author = {Xabi Ezpeleta},
title = {GECToR v5 ONNX: int4 in-browser Basque Grammatical Error
Correction with error types},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/itzune/gector-eus-v5-onnx}},
note = {Quantized from \url{https://huggingface.co/itzune/gector-eus-v5}}
}
References
- Omelianchuk, K. et al. (2020). GECToR β Grammatical Error Correction: Tag, Not Rewrite. BEA@ACL. arXiv:2005.12592
- itzune/gector-eus-v2 β decode loop, cascade, evaluation
- txukun β in-browser writing assistant using this bundle
- ONNX Runtime Β· Transformers.js
- Base encoder:
ixa-ehu/roberta-eus-euscrawl-base-cased - Training data:
itzune/horkonpon-corpus,itzune/wiki-gec-distill-eu - Basque Wikipedia dump
euwiki-20261101(dumps.wikimedia.org) - hunspell
eu_ESdictionary (spelling cascade)
Model tree for itzune/gector-eus-v5-onnx
Base model
ixa-ehu/roberta-eus-euscrawl-base-cased