shijx12 / KQAPro_Baselines

Pytorch implementation of baseline models of KQA Pro, a large-scale dataset of complex question answering over knowledge base.
http://thukeg.gitee.io/kqa-pro/
MIT License
127 stars 22 forks source link

forward() got an unexpected keyword argument 'lm_labels' #2

Closed yhshu closed 3 years ago

yhshu commented 3 years ago

2021-03-04 13:59:21,045 INFO     Checking...
2021-03-04 13:59:21,045 INFO     ===================Dev==================
Traceback (most recent call last):
  File "/home/home1/yhshu/.conda/envs/pytorch16/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/home1/yhshu/.conda/envs/pytorch16/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/home1/yhshu/workspace/FusionQA/KQAPro_Baselines-master/Bart_SPARQL/train.py", line 200, in <module>
    main()
  File "/home/home1/yhshu/workspace/FusionQA/KQAPro_Baselines-master/Bart_SPARQL/train.py", line 196, in main
    train(args)
  File "/home/home1/yhshu/workspace/FusionQA/KQAPro_Baselines-master/Bart_SPARQL/train.py", line 112, in train
    outputs = model(**inputs)
  File "/home/home1/yhshu/.conda/envs/pytorch16/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
TypeError: forward() got an unexpected keyword argument 'lm_labels'

I think KQA Pro is a very good work. However, I ran into some problems while running the experiments. The repository does not describe how to import BART models, and I directly used facebook/bart-base as the model name and encountered the problem above.

ShulinCao commented 3 years ago

The problem is caused by transformer version. Maybe you can change 'lm_labels' to 'labels'.

yhshu commented 3 years ago

Thanks for your advice. It works now.