GithubHelp home page GithubHelp logo

hughblayney / 2d-equivariant-diffusion Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 266 KB

Generating 2D structues using a generative diffusion model, composed of rotationally equivariant Graph Convolutional Layers.

License: MIT License

Python 100.00%

2d-equivariant-diffusion's Introduction

2D-equivariant-diffusion

Generating 2D straight lines using a generative diffusion model, composed of rotationally equivariant GNN layers.

This code is based off the paper Equivariant Diffusion for Molecule Generation in 3D, and some parts of the code were written with their (amazing!) implementation as reference.

Motivation

The idea of this project is to demonstrate an understandable, minimal example of an equivariant diffusion model. For this purpose, I tried to simplify the problem as much as possible:

  • Created a "toy" dataset of 2D straight lines oriented along the x axis only (see straight_line_dataset.py)
  • Defined an Equivariant Graph Neural Network (EGNN) composed of equivariant Graph Convolutional layers, using pytorch_geometric and minimal code (see egnn.py)

During training, the EGNN is trained on straight line examples that have various levels of noise added to them. These examples represent a "forward" diffusion process that steadily diffuses the straight lines into isotropic Gaussians in 2D.

By sampling from a 2D isotropic Gaussian and running the reverse 2D process, we should see straight lines generated. Critically, these straight lines should not necessarily be oriented along the x axis due to the equivariant nature of the GNN, and the isotropic Gaussian from which the initial sample originated.

Here is one such example of the trained reverse diffusion process in action!

Reverse diffusion process for generating straight line

Training

For the moment the code is extremly minimal - the only entrypoint is the train file, and this trains the diffusion model, outputting GIFs of the reverse diffusion process at different epochs as it does so.

To do this, simply run the train file:

python train.py

To modify parameters, see the CONFIG dict in this file.

I will be improving this file (adding at least argparse) and adding other functionality in the future.

2d-equivariant-diffusion's People

Contributors

hughblayney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.