Error in resuming training for OpenNMT model


(Leena Shekhar) #1

I set the flags -start_epoch to 13 ( as my last model was trained till epoch 12) and -train_from to point to my latest .pt file.

Error log:

Traceback (most recent call last):
File “train.py”, line 406, in
main()
File “train.py”, line 402, in main
train_model(model, fields, optim, data_type, model_opt)
File “train.py”, line 219, in train_model
train_stats = trainer.train(train_iter, epoch, report_func)
File “/gpfs/home/lshekhar/OpenNMT-py-master/onmt/Trainer.py”, line 199, in train
for i, batch_ in enumerate(train_iter):
File “train.py”, line 129, in iter
for batch in self.cur_iter:
File “/gpfs/home/lshekhar/tools/torch/lib/python2.7/site-packages/torchtext/data/iterator.py”, line 180, in iter
self.train)
File “/gpfs/home/lshekhar/tools/torch/lib/python2.7/site-packages/torchtext/data/batch.py”, line 21, in init
batch = [x.dict[name] for x in data]
KeyError: ‘alignment’


(Leena Shekhar) #2

I guess my issue is related to the one mentioned here: https://github.com/OpenNMT/OpenNMT-py/issues/529. I updated the code and started the training