lil-lab/atis

Cannot convert _dynet.Parameters to _dynet.Expression

ryanzhumich opened this issue · 2 comments

Hi,

I am running into an issue about dynet:

File "/data/lily/rz268/dialog2sql/atis/interaction_model.py", line 170, in
lambda token: dy.concatenate([self.input_embedder(token), discourse_state]), dropout_amount=self.dropout)
File "_dynet.pyx", line 4366, in _dynet.concatenate
File "_dynet.pyx", line 4382, in _dynet.concatenate
TypeError: Cannot convert _dynet.Parameters to _dynet.Expression

Do you happen to know the reason? Is this related to the DyNet version?

Thanks a lot!

I suspect this is a DyNet version incompatibility. In older versions of DyNet (circa early last year), you had to call dy.parameter() to convert a parameter (e.g., in this case the word embedding vector looked up for the token) to an expression; this requirement was done away with in newer versions

It should be noticed that in DyNet 2.0.4+, the dy.parameters() is depecated so explicitly adding parameters to the computation graph is no longer necessary. Any used parameter will be added automatically.

(From https://dynet.readthedocs.io/en/latest/tutorials_notebooks/API.html)

Please try either calling dy.parameter(self.input_embedder(token)) before concatenating with discourse_state, or updating the version of DyNet to something past 2.0.4.

Hope this helps.

Thank you Alane! I installed
pip install dynet==2.1.0
It works!