Este repositorio proporciona código para capacitar y probar modelos de última generación para la corrección de errores gramaticales con la implementación oficial de Pytorch del siguiente documento:
Gector - Corrección de errores gramaticales: etiqueta, no reescribir
KOSTIANTYN OMELIANCHUK, Vitaliy Atrasevych, Artem Chernodub, Oleksandr Skurzhanskyi
Gramática
15 ° taller sobre uso innovador de PNL para construir aplicaciones educativas (ubicadas con ACL 2020)
Se basa principalmente en AllenNLP y transformers .
El siguiente comando instala todos los paquetes necesarios:
pip install -r requirements.txtEl proyecto se probó con Python 3.7.
Todos los conjuntos de datos GEC públicos utilizados en el documento se pueden descargar desde aquí.
Los conjuntos de datos creados sintéticamente se pueden generar/descargar aquí.
Para entrenar los datos del modelo deben ser preprocesados y convertidos en formato especial con el comando:
python utils/preprocess_data.py -s SOURCE -t TARGET -o OUTPUT_FILE| Codificador | Sesgo de confianza | Probable de error mínimo | Connl-2014 (prueba) | BEA-2019 (prueba) |
|---|---|---|---|---|
| Bert [enlace] | 0.1 | 0.41 | 61.0 | 68.0 |
| Roberta [enlace] | 0.2 | 0.5 | 64.0 | 71.8 |
| Xlnet [enlace] | 0.2 | 0.5 | 63.2 | 71.2 |
Nota : Los puntajes en la tabla son diferentes de los del documento, ya que se usa la versión posterior de Transformers. Para reproducir los resultados reportados en el documento, use esta versión del repositorio.
Para entrenar el modelo, simplemente ejecute:
python train.py --train_set TRAIN_SET --dev_set DEV_SET
--model_dir MODEL_DIRHay muchos parámetros para especificar entre ellos:
cold_steps_count el número de épocas donde entrenamos solo la última capa linealtransformer_model {bert,distilbert,gpt2,roberta,transformerxl,xlnet,albert} Modelo Model Codertn_prob Probabilidad de obtener oraciones sin errores; Ayuda a equilibrar la precisión/retiropieces_per_token número máximo de subvenciones por token; ayuda a no sacar a Cuda de la memoriaEn nuestros experimentos tuvimos una división de tren/desarrollo 98/2.
Describimos todos los parámetros que usamos para capacitar y evaluar aquí.
Para ejecutar su modelo en el archivo de entrada, use el siguiente comando:
python predict.py --model_path MODEL_PATH [MODEL_PATH ...]
--vocab_path VOCAB_PATH --input_file INPUT_FILE
--output_file OUTPUT_FILEEntre los parámetros:
min_error_probability - probabilidad de error mínimo (como en el documento)additional_confidence - sesgo de confianza (como en el documento)special_tokens_fix para reproducir algunos resultados reportados de modelos previos aPara evaluación, use m^2scorer y errante.
Este repositorio también implementa el código del siguiente documento:
Simplificación de texto etiquetando
KOSTIANTYN OMELIANCHUK, Vipul Raheja, Oleksandr Skurzhanskyi
Gramática
16º Taller sobre el uso innovador de PNL para la construcción de aplicaciones educativas (ubicado en W EACL 2021)
Para el preprocesamiento de datos, se podría utilizar el entrenamiento y la prueba de la misma interfaz que para GEC. Para las etapas de entrenamiento y evaluación utils/filter_brackets.py se usa para eliminar el ruido. Durante la inferencia, usamos -Flagal --normalize .
| SARI | FKGL | ||
|---|---|---|---|
| Modelo | Turco | ACTIVO | |
| TST-final [enlace] | 39.9 | 40.3 | 7.65 |
| TST-FINAL + TAKES | 41.0 | 42.7 | 7.61 |
Inferencia Ajuste los parámetros:
iteration_count = 2
additional_keep_confidence = -0.68
additional_del_confidence = -0.84
min_error_probability = 0.04
Para la evaluación, use el paquete Easse.
Nota : Los puntajes en la tabla están muy cerca de los del documento, pero no coinciden completamente debido a las 2 razones:
Si encuentra que este trabajo es útil para su investigación, cite nuestros documentos:
@inproceedings{omelianchuk-etal-2020-gector,
title = "{GECT}o{R} {--} Grammatical Error Correction: Tag, Not Rewrite",
author = "Omelianchuk, Kostiantyn and
Atrasevych, Vitaliy and
Chernodub, Artem and
Skurzhanskyi, Oleksandr",
booktitle = "Proceedings of the Fifteenth Workshop on Innovative Use of NLP for Building Educational Applications",
month = jul,
year = "2020",
address = "Seattle, WA, USA → Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2020.bea-1.16",
pages = "163--170",
abstract = "In this paper, we present a simple and efficient GEC sequence tagger using a Transformer encoder. Our system is pre-trained on synthetic data and then fine-tuned in two stages: first on errorful corpora, and second on a combination of errorful and error-free parallel corpora. We design custom token-level transformations to map input tokens to target corrections. Our best single-model/ensemble GEC tagger achieves an F{_}0.5 of 65.3/66.5 on CONLL-2014 (test) and F{_}0.5 of 72.4/73.6 on BEA-2019 (test). Its inference speed is up to 10 times as fast as a Transformer-based seq2seq GEC system.",
}
@inproceedings{omelianchuk-etal-2021-text,
title = "{T}ext {S}implification by {T}agging",
author = "Omelianchuk, Kostiantyn and
Raheja, Vipul and
Skurzhanskyi, Oleksandr",
booktitle = "Proceedings of the 16th Workshop on Innovative Use of NLP for Building Educational Applications",
month = apr,
year = "2021",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2021.bea-1.2",
pages = "11--25",
abstract = "Edit-based approaches have recently shown promising results on multiple monolingual sequence transduction tasks. In contrast to conventional sequence-to-sequence (Seq2Seq) models, which learn to generate text from scratch as they are trained on parallel corpora, these methods have proven to be much more effective since they are able to learn to make fast and accurate transformations while leveraging powerful pre-trained language models. Inspired by these ideas, we present TST, a simple and efficient Text Simplification system based on sequence Tagging, leveraging pre-trained Transformer-based encoders. Our system makes simplistic data augmentations and tweaks in training and inference on a pre-existing system, which makes it less reliant on large amounts of parallel training data, provides more control over the outputs and enables faster inference speeds. Our best model achieves near state-of-the-art performance on benchmark test datasets for the task. Since it is fully non-autoregressive, it achieves faster inference speeds by over 11 times than the current state-of-the-art text simplification system.",
}