mkusner / grammarVAE

Code for the "Grammar Variational Autoencoder" https://arxiv.org/abs/1703.01925
269 stars 78 forks source link

TypeError: object of type 'filter' has no len() #32

Closed cahsmann closed 3 years ago

cahsmann commented 3 years ago

I am getting this error at line 12 in molecule_vae.py

nzarnaghi commented 3 years ago

Hi,

Python 2.7 is getting deprecated. That is why it shows this error. I changed that line to "assert len(list(long_tokens)) == len(list(replacements))" and it worked. I put some upgraded codes to Python3 here:

https://github.com/nzarnaghi/GrammarVAE_py3

mkusner commented 3 years ago

Thanks for the upgrade! I recommend using this above code or the pytorch grammar vae code here when using python 3!: https://github.com/geyang/grammar_variational_autoencoder