Glaciohound / VCML

PyTorch implementation of paper "Visual Concept-Metaconcept Learner", NeruIPS 2019
http://vcml.csail.mit.edu
MIT License
48 stars 8 forks source link

"KeyError: 'program_parsed'" when running the program #1

Open dlshu opened 4 years ago

dlshu commented 4 years ago

Hi. I tried to test the pretrained model using the test data from CLEVR dataset but had a error 'KeyError: 'program_parsed''. The command I typed in is as follows.

jac-crun 0 scripts/main.py --mode run-experiment --task CLEVR --model VCML --experiment synonym_generalization --log_dir ../data/log --data_dir ../data/ --pretrained --in_epoch test

and the error message shown is as follows.

0:00:52.63 => epoch 0
0:00:52.85 -----> Testing

Traceback (most recent call last):
File "scripts/main.py", line 44, in main() File "scripts/main.py", line 34, in main run_experiment.run(args) File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/run_experiment.py", line 181, in run processes[0]._target(processes[0]._args) File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/run_experiment.py", line 151, in ready_go train(coach, args) File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/utils/train.py", line 223, in train run_epoch(coach, args, coach.epoch) File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/utils/train.py", line 192, in run_epoch True, False File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/utils/train.py", line 142, in any_epoch inner() File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/utils/train.py", line 128, in inner loss, outputs = run_batch(data, model, args) File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/scripts/utils/train.py", line 82, in run_batch losses, outputs, debugs, objects = model(data) File "/home/dule/anaconda3/envs/VCML/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(input, **kwargs) File "/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/models/model/vcml_model.py", line 87, in forward program = data['program_parsed'] KeyError: 'program_parsed'

/home/dule/Desktop/NN/AAAI_21/nuero-symbolic_ai/VCML/models/model/vcml_model.py(87)forward() 85 program_encoded = data['program_encoded'] 86 else: ---> 87 program = data['program_parsed'] 88 program_encoded = data['program_parsed_encoded'] 89

ipdb>

Any suggestions how to fix this issue? Thank you very much!

anette123 commented 3 years ago

Getting the same error. If I modify 'inner()' function in train.py when 'is_train=False' to estimate 'program parsed' and 'program_parsed_encoded' just like when 'is_train=True' , the code will proceed further, but will fail as the downloaded parser cannot parse test questions. That is, the first 10 questions from the test set:

# Out[93]: TEST QUESTIONS
# ['Is small a synonym of small?',
#  'Is sphere a synonym of sphere?',
#  'Is shiny a synonym of shiny?',
#  'Is sphere a synonym of shiny?',
#  'Is sphere a synonym of small?',
#  'Is shiny a synonym of shiny?',
#  'Is shiny a synonym of sphere?',
#  'Is small a synonym of shiny?',
#  'Is shiny a synonym of small?',
#  'Is small a synonym of small?']

And the parser will process them in the following way (showing the first two):

# Out[96]:
# [[{'operation': '<END>', 'argument': 'small'},
#   {'operation': '<END>', 'argument': 'small'},
#   {'operation': '<END>', 'argument': '<END>'},
#   {'operation': '<END>', 'argument': '<END>'},
#   {'operation': '<END>', 'argument': '<END>'}],
#  [{'operation': '<END>', 'argument': 'sphere'},
#   {'operation': '<END>', 'argument': 'sphere'},
#   {'operation': '<END>', 'argument': '<END>'},
#   {'operation': '<END>', 'argument': '<END>'},
#   {'operation': '<END>', 'argument': '<END>'}],

Could you please have a look at this? I suspect the parser provided cannot process meta concept words like 'synonym'..

anette123 commented 3 years ago

Update to my previous comment: have been testing the parser separately, and while in parser.tools.operation.records it contains 'synonym', it is always predicting '10' for operation, which is '' for the test questions. Below listing parser operatons.

['select_concept',
 'synonym',
 'isinstanceof',
 'samekind',
 'select_object',
 'filter',
 'exist',
 'classify',
 '<NULL>',
 '<START>',
 '<END>',
 '<UNK>']
coldmanck commented 3 years ago

Same issue here. @anette123 may I know if you have solved this problem?

coldmanck commented 3 years ago

I'd also like to call for the authors' attention to this issue @vacancy @Glaciohound