aspuru-guzik-group / chemical_vae

Code for 10.1021/acscentsci.7b00572, now running on Keras 2.0 and Tensorflow
Apache License 2.0
470 stars 178 forks source link

NameError: name 'TerminalGRU' is not defined #26

Open ramashka328 opened 4 years ago

ramashka328 commented 4 years ago

Hi. I am trying to implement your model using the code line as follows:

vae = VAEUtils(directory='C:\Users\Autoencoder\chemical_vae-master\models\zinc_properties')

but however it results in the error:

~\Autoencoder\chemical_vae-master\chemvae\vae_utils.py in init(self, exp_file, encoder_file, decoder_file, directory) 55 # encoder, decoder 56 self.enc = load_encoder(self.params) ---> 57 self.dec = load_decoder(self.params) 58 self.encode, self.decode = self.enc_dec_functions() 59 self.data = None

~\Autoencoder\chemical_vae-master\chemvae\vae_utils.py in load_decoder(params) 21 def load_decoder(params): 22 if params['do_tgru']: ---> 23 return load_model(params['decoder_weights_file'], custom_objects={'TerminalGRU': TerminalGRU}) 24 else: 25 return load_model(params['decoder_weights_file'])

NameError: name 'TerminalGRU' is not defined

Could you tell me, what should I do to make it work?

mkduong-ai commented 4 years ago

Did you install it via setup.py? tgru_k2_gpu.py is the file where the TerminalGRU Layer is defined for the decoder model. Check whether vae_utils.py has from tgru_k2_gpu import TerminalGRU in it.

ramashka328 commented 4 years ago

Thank You, it worked when I installed it using setup.py.