I trained my model using pre-trained word embedding
Train command:
python3 train.py --embedding-file word2vec_baike.txt --batch-size 128 --data-dir data/train/preprocessed --train-file train-processed-corenlp.txt --dev-file dev-processed-corenlp.txt --dev-json dev.json --embed-dir data --model-name model3 --parallel True --weight-decay 0.0001 --momentum 0.9
After training, I try to use the trained model with interactive.py but I got such error:
Traceback (most recent call last):
File "interactive.py", line 55, in
normalize=False)
File "/home/oyyj/Programs/QA/drqa/reader/predictor.py", line 61, in init
normalize=normalize)
File "/home/oyyj/Programs/QA/drqa/reader/model.py", line 436, in load
return DocReader(args, word_dict, feature_dict, state_dict, normalize)
File "/home/oyyj/Programs/QA/drqa/reader/model.py", line 59, in init
self.network.load_state_dict(state_dict)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 490, in load_state_dict
.format(name))
KeyError: 'unexpected key "module.embedding.weight" in state_dict'
I am very confused and don't know why.
Can anyone help me?
I trained my model using pre-trained word embedding Train command: python3 train.py --embedding-file word2vec_baike.txt --batch-size 128 --data-dir data/train/preprocessed --train-file train-processed-corenlp.txt --dev-file dev-processed-corenlp.txt --dev-json dev.json --embed-dir data --model-name model3 --parallel True --weight-decay 0.0001 --momentum 0.9
After training, I try to use the trained model with interactive.py but I got such error:
Traceback (most recent call last): File "interactive.py", line 55, in
normalize=False)
File "/home/oyyj/Programs/QA/drqa/reader/predictor.py", line 61, in init
normalize=normalize)
File "/home/oyyj/Programs/QA/drqa/reader/model.py", line 436, in load
return DocReader(args, word_dict, feature_dict, state_dict, normalize)
File "/home/oyyj/Programs/QA/drqa/reader/model.py", line 59, in init
self.network.load_state_dict(state_dict)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 490, in load_state_dict
.format(name))
KeyError: 'unexpected key "module.embedding.weight" in state_dict'
I am very confused and don't know why. Can anyone help me?
Env: python3.5 pytorch0.3