Open Auroraywood opened 4 years ago
I checked this part of code in my own machine (PyTorch = 1.0 or 1.3 stable), but I did not find such a bug. Could you tell me the version of PyTorch?
Thank you very much! The version of my pytorch is higher and I have alreadly figure the problem out! But now, I have met another error, when I train prior model on the data zinc_corpus.txt, it occurs keyerror when encode, so I modify voc = util.Voc("data/voc.txt")
to voc = util.Voc("data/zinc_voc.txt")
, then keyerror in encode disappeared, but now decode occurs keyerror again, this time I am confused.
Traceback (most recent call last):
File "pretrainer.py", line 60, in <module>
main()
File "pretrainer.py", line 27, in main
prior.fit(zinc, out=netP_path)
File "/home/tensorflow/DrugEx/model.py", line 428, in fit
smiles, valids = util.check_smiles(seqs, self.voc)
File "/home/tensorflow/DrugEx/util.py", line 232, in check_smiles
smile = voc.decode(seq)
File "/home/tensorflow/DrugEx/util.py", line 94, in decode
chars.append(self.ix2tk[i])
KeyError: 0
Thanks for reminding me this bug. It is caused by the duplication of 'EOS' in vocabulary defined in the file of 'voc.txt'. I have modified the 'util.py' and removed the 'EOS' defined in token sequences. If you do not want to regenerate the corpus, you can simply remove 'EOS' in the file of 'voc.txt'
Thank you very much.
Hi!
An error occurs when I run pretrainer.py. Can you give me some advice? Thanks a lot!
Issue summary