You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds support for MolGAN, a GAN-based model for molecular graph generation. It includes the MolGAN class, which is a class compatible with the BaseMolecularGenerator class with configurable architecture. It also uses RewardOracle, which supports both Neural Network-based reward function (based on the RewardNeuralNetwork and the NonNeuralNetwork reward class. However, please note that the neural network RL implementation does require more work. It also allows for future explorations, which can include config classes for defining generators and discriminators in the GAN class. Also allows for the graph implementation, which allows conversion from SMILE data and graphs with graph representation. Note that we do need to activate use_reward for the reward based training to work, otherwise works as a regular GAN. Future PRs can include Hugging Face support and better reward functions.
In the implementation of the generator you hard code the following:
node = F.gumbel_softmax(node, tau=self.config.tau, hard=True, dim=-1)
adj = F.gumbel_softmax(adj, tau=self.config.tau, hard=True, dim=1)
However during training this would give discreet structures which can be hard to backprogate through. I believe in the original implementation they use a softmax function with the option for the user to switch between softmax, soft_gumbel and hard gumbel. During evaluation one can then use torch.max to get a discreet structure.
For the reward network they pretrain this for the first half of the epochs, after the first half of the epochs they add the reward network into the generator loss function .
You have two options for the reward, the Oracle and the reward network, I believe there should only be the reward network and the oracle is used to train this network? Ther reward network used in the original paper is the same as the discriminator architecture however they change the last layer to a sigmoid activation function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Solves issue: #8
This PR adds support for MolGAN, a GAN-based model for molecular graph generation. It includes the
MolGANclass, which is a class compatible with theBaseMolecularGeneratorclass with configurable architecture. It also usesRewardOracle, which supports both Neural Network-based reward function (based on theRewardNeuralNetworkand theNonNeuralNetworkreward class. However, please note that the neural network RL implementation does require more work. It also allows for future explorations, which can include config classes for defining generators and discriminators in the GAN class. Also allows for the graph implementation, which allows conversion from SMILE data and graphs with graph representation. Note that we do need to activate use_reward for the reward based training to work, otherwise works as a regular GAN. Future PRs can include Hugging Face support and better reward functions.