grammarly / gector

Official implementation of the papers "GECToR – Grammatical Error Correction: Tag, Not Rewrite" (BEA-20) and "Text Simplification by Tagging" (BEA-21)
Apache License 2.0
894 stars 216 forks source link

training problem #126

Closed Yang-HangWA closed 3 years ago

Yang-HangWA commented 3 years ago

I run the train.py file as follow to train the model: python train.py --train_set ../fce/m2/fce.train.gold.bea19.m2 --dev_set ../fce/m2/fce.dev.gold.bea19.m2 --vocab_path ./data/output_vocabulary/ --model_dir ./ --transformer_mode distilbert

Then I got the problem like below. Anyone know how to fix it ?? File "/work/gector_data/gector/gector/trainer.py", line 273, in batch_loss output_dict = training_util.data_parallel(batch_group, self.model, self._cuda_devices) File "/usr/local/lib/python3.7/site-packages/allennlp/training/util.py", line 335, in data_parallel losses = gather([output['loss'].unsqueeze(0) for output in outputs], used_device_ids[0], 0) File "/usr/local/lib/python3.7/site-packages/allennlp/training/util.py", line 335, in losses = gather([output['loss'].unsqueeze(0) for output in outputs], used_device_ids[0], 0) KeyError: 'loss'

skurzhanskyi commented 3 years ago

Please take a look at README. You should use a special processed format, not m2.

Yang-HangWA commented 3 years ago

@skurzhanskyi Thanks for your reply, but how to process the dataset of FCE v2.1? What's more, what the training data should look like?

skurzhanskyi commented 3 years ago

First, you should extract parallel data from m2 files. By parallel data, I mean two files: one with source sentences (with errors) and another with target sentences (without errors). Then you need to pass this data to utils/preprocess_data.py to generate the particular training format we use in training.

Yang-HangWA commented 3 years ago

@skurzhanskyi Thanks,I can train now.