Domain Language with side args execution bug
In my DomainLanguage if I have a @predicate without a side_arg, say
@predicate
def find_passageSpanAnswer(self, passage_attention: PA) -> PSA:
The grammar is made in the correct manner, i.e. the following production is added
'<PA:PSA> -> find_passageSpanAnswer'.
During execution if the side_args dictionary contains a key passage_attention that value is used instead which throws an error. I have tried by changing the argument's name in the predicate definition and the error disappears.
There seems to be a bug in execution with side_args.
@yizhongw can you take a look at this?
Yizhong doesn't have context on this one. It'd be pretty easy for me to fix but I think that @nitishgupta could fix it also. Care to submit a PR for this, Nitish?
I haven't tried to trace the error, let me give it a shot and submit a PR asap.
Hmm, looking at this a little more, maybe it isn't so easy. The problem is here: https://github.com/allenai/allennlp/blob/53a46ab7227a7f4293030c06a1ad18d010e87d74/allennlp/semparse/domain_languages/domain_language.py#L566-L567. You need to only add the parameter to kwargs if the argument has been registered to the function as a side argument. I'm not sure off the top of my head how to fix this, and I'm on vacation, so I'm only doing a cursory look into this. I can fix it when I get back, or you can try; hopefully this was enough to get you started, if you want to look into it.