Closed hwidong-na closed 3 years ago
Hi,
Please use the code in polymer/ directory for polymer generation. The tree decomposition there is different and it will give you bee hives.
Training vae raises the following error.
hgraph2graph/polymers$ python vae_train.py --train train_processed/ --vocab ../data/polymers/inter_vocab.txt --save_dir ckpt/tmp
Model #Params: 5708K
Traceback (most recent call last):
File "vae_train.py", line 80, in <module>
loss, kl_div, wacc, iacc, tacc, sacc = model(*batch, beta=beta)
File "/home/leona/anaconda3/envs/motif/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
hgraph2graph/polymers/poly_hgraph/hgnn.py", line 77, in forward
loss, wacc, iacc, tacc, sacc = self.decoder((root_vecs, root_vecs, root_vecs), graphs, tensors, orders)
File "/home/leona/anaconda3/envs/motif/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889,
result = self.forward(*input, **kwargs)
hgraph2graph/polymers/poly_hgraph/decoder.py", line 229, in forward
clab, ilab = self.vocab[ tree_batch.nodes[yid]['label'] ]
hgraph2graph/polymers/poly_hgraph/vocab.py", line 43, in __getitem__
return self.hmap[x[0]], self.vmap[x]
KeyError: 'O=C1NC(=O)C2=C3C1=CC=C1C(=O)NC(=O)C(=C13)C=C2'
Solved: It is required to use the same RDKit version for generating vocab.txt
Hi,
I have a question for the tree decomposition function below, especially related to structural motifs (bee hives).
https://github.com/wengong-jin/hgraph2graph/blob/e396dbaf43f9d4ac2ee2568a4d5f93ad9e78b767/hgraph/mol_graph.py#L54-L83
It seems structural motifs are not extracted from the code above. For example, converting a polymer smiles using
mol_graph
results only bonds and single rings, not bee hives.
Any suggestions?