이 저장소는 다음 논문의 공식 Pytorch 구현과 함께 문법 오류 수정을위한 최첨단 모델 교육 및 테스트 코드를 제공합니다.
Gector - 문법 오류 수정 : 태그가 다시 작성되지 않습니다
Kostiantyn Omelianchuk, Vitaliy Atrasevych, Artem Chernodub, Oleksandr Skurzhanskyi
문법
교육 응용 프로그램 구축을위한 NLP의 혁신적인 사용에 관한 15 번째 워크숍 (ACL 2020과 공동으로 배치)
주로 AllenNLP 및 transformers 기반으로합니다.
다음 명령은 필요한 모든 패키지를 설치합니다.
pip install -r requirements.txt이 프로젝트는 Python 3.7을 사용하여 테스트되었습니다.
논문에 사용 된 모든 공개 GEC 데이터 세트는 여기에서 다운로드 할 수 있습니다.
합성 적으로 생성 된 데이터 세트는 여기에서 생성/다운로드 할 수 있습니다.
모델 데이터를 훈련하려면 전처리하고 명령을 통해 특수 형식으로 변환해야합니다.
python utils/preprocess_data.py -s SOURCE -t TARGET -o OUTPUT_FILE| 사전 예방 인코더 | 신뢰 편견 | 최소 오류 프로브 | Connl-2014 (테스트) | BEA-2019 (테스트) |
|---|---|---|---|---|
| 버트 [링크] | 0.1 | 0.41 | 61.0 | 68.0 |
| Roberta [링크] | 0.2 | 0.5 | 64.0 | 71.8 |
| xlnet [링크] | 0.2 | 0.5 | 63.2 | 71.2 |
참고 : 테이블의 점수는 트랜스포머의 이후 버전이 사용되므로 종이의 점수와 다릅니다. 논문에보고 된 결과를 재현하려면이 버전의 저장소를 사용하십시오.
모델을 훈련 시키려면 간단히 실행하십시오.
python train.py --train_set TRAIN_SET --dev_set DEV_SET
--model_dir MODEL_DIR그들 사이에 지정할 수있는 많은 매개 변수가 있습니다.
cold_steps_count 우리가 마지막 선형 레이어 만 훈련하는 에포크 수transformer_model {bert,distilbert,gpt2,roberta,transformerxl,xlnet,albert} 모델 인코더tn_prob 오류없이 문장을받을 확률; 정밀/리콜의 균형을 맞추는 데 도움이됩니다pieces_per_token 토큰 당 하위 단어의 최대 수; Cuda를 기억에서 꺼내지 않도록 도와줍니다우리의 실험에서 우리는 98/2 Train/Dev Split이있었습니다.
우리는 여기에서 훈련 및 평가에 사용하는 모든 매개 변수를 설명했습니다.
입력 파일에서 모델을 실행하려면 다음 명령을 사용하십시오.
python predict.py --model_path MODEL_PATH [MODEL_PATH ...]
--vocab_path VOCAB_PATH --input_file INPUT_FILE
--output_file OUTPUT_FILE매개 변수 중 :
min_error_probability 최소 오류 확률 (논문에서와 같이)additional_confidence 신뢰 편견 (논문에서와 같이)special_tokens_fix 사전에보고 된 모델의 일부 결과를 재현합니다평가를 위해 M^2Scorer 및 잘못 사용하십시오.
이 저장소는 또한 다음 논문의 코드를 구현합니다.
태깅으로 텍스트 단순화
Kostiantyn Omelianchuk, Vipul Raheja, Oleksandr Skurzhanskyi
문법
교육 응용 프로그램 구축을위한 NLP의 혁신적인 사용에 관한 16 번째 워크숍 (공동 위치 W EACL 2021)
데이터 전처리의 경우 GEC와 동일한 인터페이스를 사용할 수있는 교육 및 테스트를 사용할 수 있습니다. 교육 및 평가 단계 모두 utils/filter_brackets.py 노이즈를 제거하는 데 사용됩니다. 추론하는 동안 -우리는 --normalize 깃발을 사용합니다.
| 사리 | fkgl | ||
|---|---|---|---|
| 모델 | 투르코 푸스 | 유산 | |
| TST-FINAL [LINK] | 39.9 | 40.3 | 7.65 |
| TST-Final + 조정 | 41.0 | 42.7 | 7.61 |
추론 조정 매개 변수 :
iteration_count = 2
additional_keep_confidence = -0.68
additional_del_confidence = -0.84
min_error_probability = 0.04
평가를 위해 EASSE 패키지를 사용하십시오.
참고 : 테이블의 점수는 논문의 점수와 매우 가깝지만 두 가지 이유로 인해 완전히 일치하지 않습니다.
이 작업이 연구에 유용하다는 것을 알게되면 논문을 인용하십시오.
@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.",
}