Instructions to use gotutiyan/gector-deberta-base-5k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gotutiyan/gector-deberta-base-5k with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("gotutiyan/gector-deberta-base-5k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
metadata
language: en
tags:
- GECToR_gotutiyan
- grammatical error correction
Only non-commercial purposes.
gector sample
This is an unofficial pretrained model of GECToR (Omelianchuk+ 2020).
How to use
The code is avaliable from https://github.com/gotutiyan/gector.
CLI
python predict.py --input <raw text file> --restore_dir gotutiyan/gector-deberta-base-5k --out <path to output file>
API
from transformers import AutoTokenizer
from gector.modeling import GECToR
from gector.predict import predict, load_verb_dict
import torch
model_id = 'gotutiyan/gector-deberta-base-5k'
model = GECToR.from_pretrained(model_id)
if torch.cuda.is_available():
model.cuda()
tokenizer = AutoTokenizer.from_pretrained(model_id)
encode, decode = load_verb_dict('data/verb-form-vocab.txt')
srcs = [
'This is a correct sentence.',
'This are a wrong sentences'
]
corrected = predict(
model, tokenizer, srcs,
encode, decode,
keep_confidence=0.0,
min_error_prob=0.0,
n_iteration=5,
batch_size=2,
)
print(corrected)