Xie-Minghui / GFC

Official pytorch implementation of EMNLP 2022 long paper “A Sequential Flow Control Framework for Multi-hop Knowledge Base Question Answering”
15 stars 3 forks source link

CWQ operation error #3

Closed Buffalo-q closed 1 year ago

Buffalo-q commented 1 year ago

Hello author, I encountered a runtime error while running CWQ code. Could you please take a look at the issue when you have time. run:python demo_cwq.py --input_dir data/CWQ --save_dir checkpoints/CWQ --ckpt checkpoints/CWQ/model_cwq.pt response: Traceback (most recent call last): File "demo_cwq.py", line 120, in main() File "demo_cwq.py", line 116, in main test(args) File "demo_cwq.py", line 41, in test model.load_state_dict(torch.load(args.ckpt)) File "/root/miniconda3/envs/GFC/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1604, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for GFC: size mismatch for rel_classifier.weight: copying a param with shape torch.Size([13298, 768]) from checkpoint, the shape in current model is torch.Size([6649, 768]). size mismatch for rel_classifier.bias: copying a param with shape torch.Size([13298]) from checkpoint, the shape in current model is torch.Size([6649]).

Xie-Minghui commented 1 year ago

Hello author, I encountered a runtime error while running CWQ code. Could you please take a look at the issue when you have time. run:python demo_cwq.py --input_dir data/CWQ --save_dir checkpoints/CWQ --ckpt checkpoints/CWQ/model_cwq.pt response: Traceback (most recent call last): File "demo_cwq.py", line 120, in main() File "demo_cwq.py", line 116, in main test(args) File "demo_cwq.py", line 41, in test model.load_state_dict(torch.load(args.ckpt)) File "/root/miniconda3/envs/GFC/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1604, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for GFC: size mismatch for rel_classifier.weight: copying a param with shape torch.Size([13298, 768]) from checkpoint, the shape in current model is torch.Size([6649, 768]). size mismatch for rel_classifier.bias: copying a param with shape torch.Size([13298]) from checkpoint, the shape in current model is torch.Size([6649]).

you should run:python demo_cwq.py --input_dir data/CWQ --save_dir checkpoints/CWQ --ckpt checkpoints/CWQ/model_cwq.pt --rev please add --rev, then 6649*2=13298 will be right.

Buffalo-q commented 1 year ago

Thank you very much.I'll try again.