Scinawa / quantum-gan

PyTorch and PennyLane implementation of Quantum GAN with Hybrid Generator.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quantum GAN with Hybrid Generator

PennyLane and Pytorch implementation of QGAN-HG: Quantum generative models for small molecule drug discovery, based on MolGAN (https://arxiv.org/abs/1805.11973)
This library refers to the following source code.

For details see Quantum Generative Models for Small Molecule Drug Discovery by Junde Li, Rasit Topaloglu, and Swaroop Ghosh.

Dependencies

Structure

  • data: should contain your datasets. If you run download_dataset.sh the script will download the dataset used for the paper (then you should run data/sparse_molecular_dataset.py to conver the dataset in a graph format used by MolGAN models).
  • models: Class for Models.

Training

python main.py --quantum True --layer 2 --qubits 10 --complexity 'hr'

If you want to run classical MolGAN, please set quantum argument to False. But you can still train reduced models by setting complexity to 'hr'-highly reduced (around 2% of original generator papameters), 'mr'-moderately reduced (around 15%), or 'nr'-no reduce. Layer and qubits can adjust expressive power of variational quantum circuit.

python p2_qgan_hg.py

Run 'p2_qgan_hg'.py or 'p4_qgan_hg.py' for implementing patched quantum GAN with hybrid generator for 2 pathes and 4 patches, respectively.

Demo

You can see generated small molecules with pretrined models which are included in qgan-hg/models. Quantum circuit parameters are shown in gen_weights.csv. Inference can be done on either PennyLane quantum simulator or real IBM quantum computers.

qgan-hg-demo.ipynb 

Below are some generated molecules:

Citation

@ARTICLE{2021arXiv210103438L,
       author = {{Li}, Junde and {Topaloglu}, Rasit and {Ghosh}, Swaroop},
        title = "{Quantum Generative Models for Small Molecule Drug Discovery}",
      journal = {arXiv e-prints},
     keywords = {Computer Science - Emerging Technologies, Computer Science - Machine Learning, Quantum Physics},
         year = 2021,
        month = jan,
          eid = {arXiv:2101.03438},
        pages = {arXiv:2101.03438},
archivePrefix = {arXiv},
       eprint = {2101.03438},
 primaryClass = {cs.ET},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2021arXiv210103438L},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

About

PyTorch and PennyLane implementation of Quantum GAN with Hybrid Generator.

License:MIT License


Languages

Language:Python 84.6%Language:Jupyter Notebook 15.2%Language:Shell 0.2%