icml18-jtnn icon indicating copy to clipboard operation
icml18-jtnn copied to clipboard

gen_latent.py: smile code not found

Open chaitanyadwivedii opened this issue 4 years ago • 1 comments

While generating latent representations for BO, there are a few molecules that are perhaps not in the vocabulary, I get the following error: File "gen_latent.py", line 84, in <module> mol_vec = model.encode_latent_mean(batch) File "JT-VAE/icml18-jtnn/jtnn/jtnn_vae.py", line 61, in encode_latent_mean _, tree_vec, mol_vec = self.encode(mol_batch) File "JT-VAE/icml18-jtnn/jtnn/jtnn_vae.py", line 48, in encode set_batch_nodeID(mol_batch, self.vocab) File "JT-VAE/icml18-jtnn/jtnn/jtnn_vae.py", line 22, in set_batch_nodeID node.wid = vocab.get_index(node.smiles) File "JT-VAE/icml18-jtnn/jtnn/mol_tree.py", line 18, in get_index return self.vmap[smiles] KeyError: 'C1=CN=NC=C1'

chaitanyadwivedii avatar May 21 '20 17:05 chaitanyadwivedii

I fixed this by adding the missing key to the vocab whenever this error comes up.

jenna1701 avatar May 21 '20 17:05 jenna1701