genqc

Generative Quantum Circuits

https://github.com/florianfuerrutter/genqc

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary

Keywords

diffusion-models generative-model quantum-circuits quantum-information
Last synced: 4 months ago · JSON representation ·

Repository

Generative Quantum Circuits

Basic Info
Statistics
  • Stars: 49
  • Watchers: 4
  • Forks: 13
  • Open Issues: 1
  • Releases: 2
Topics
diffusion-models generative-model quantum-circuits quantum-information
Created about 2 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

genQC · Generative Quantum Circuits

python-3.12 DOI https://florianfuerrutter.github.io/genQC huggingface.co/collections/Floki00 Online_Demo

Code repository for generating quantum circuits with diffusion models.

Generation process for 4-qubit
QFT.

📰 News

The codebase

The code contained within this repo allows the sampling of pre-trained diffusion models and includes our pipeline to fine-tune and train models from scratch. Pre-trained weights can be found on [Hugging Face] and can be downloaded automatically via our code (see minimal example). For the text CLIP model weights we use the OpenCLIP library, which will download (and cache) the CLIP model on first usage of our pipeline. In case you prefer reading a documentation, rather than notebooks or code, see the project page under [Documentation].

This repo inlcudes:

  1. genQC/ a full release of our used diffusion pipeline.
  2. src/examples/ examples and tutorials to show how to use the library.
  3. src/ the source notebooks for nbdev.

Examples

Minimal example

A minimal example to compile the 4-qubit Quantum Fourier transform (QFT) unitary, using parameterized circuits.

``` python import torch from genQC.pipeline.multimodaldiffusionpipeline import MultimodalDiffusionPipelineParametrizedCompilation from genQC.inference.sampling import generatecompilationtensors, decodetensorstobackend from genQC.utils.miscutils import infertorchdevice, setseed from genQC.platform.tokenizer.circuitstokenizer import CircuitTokenizer from genQC.benchmark.benchcompilation import SpecialUnitaries from genQC.platform.simulation import Simulator, CircuitBackendType

device = infertorchdevice() set_seed(0)

pipeline = MultimodalDiffusionPipelineParametrizedCompilation.frompretrained( repoid="Floki00/cirditmultimodalcompile3to5qubit", device=device)

pipeline.scheduler.settimesteps(40) pipeline.schedulerw.set_timesteps(40)

pipeline.gh, pipeline.gw = 0.3, 0.1 pipeline.lambdah, pipeline.lambdaw = 1.0, 0.35

U = SpecialUnitaries.QFT(num_qubits=4).to(torch.complex64)

outtensor, params = generatecompilationtensors(pipeline, prompt="Compile 4 qubits using: ['h', 'cx', 'ccx', 'swap', 'rx', 'ry', 'rz', 'cp']", U=U, samples=8, systemsize=5, numofqubits=4, max_gates=32) ```

``` python vocabulary = {g:i+1 for i, g in enumerate(pipeline.gate_pool)} tokenizer = CircuitTokenizer(vocabulary) simulator = Simulator(CircuitBackendType.QISKIT)

qclist, _ = decodetensorstobackend(simulator, tokenizer, outtensor, params) qclist[0].draw("mpl") ```

Further examples

More detailed examples and tutorial notebooks are provided on the project page [tutorials] or in the directory src/examples/.

Installation

The installation of genQC is done via pip within a few minutes, depending on your downloading speed.

Method 1: pip install

To install genQC just run:

sh pip install genQC

Note, this will install missing requirements automatically. You may want to install some of them manually beforehand, e.g. torch for specific cuda support, see https://pytorch.org/get-started/locally/.

Requirements: genQC depends on python (min. version 3.12) and the libraries: torch, numpy, matplotlib, scipy, omegaconf, qiskit, tqdm, joblib, open_clip_torch, ipywidgets, pylatexenc, safetensors, tensordict and huggingface_hub. All can be installed with pip install. In src/RELEASES.md [doc] and the GitHub release descriptions, specific tested-on versions are listed.

Method 2: clone the repository

To use the latest GitHub code, you can clone the repository by running:

sh git clone https://github.com/FlorianFuerrutter/genQC.git cd genQC

The library genQC is built using jupyter notebooks and nbdev. To install the library use in the clone directory:

sh pip install -e .

Test installation

You can run the provided src/examples/Quantum circuit synthesis with diffusion models/0_hello_circuit [doc] [notebook] example to test your installation. On a computer with a moderate GPU this inference example notebook should run under half a minute.

License

The code and weights in this repository are licensed under the Apache License 2.0.

BibTeX

We kindly ask you to cite our paper if any of the previous material was useful for your work.

Quantum circuit synthesis with diffusion models

latex @article{furrutter2024quantum, title={Quantum circuit synthesis with diffusion models}, author={F{\"u}rrutter, Florian and Mu{\~n}oz-Gil, Gorka and Briegel, Hans J}, journal={Nature Machine Intelligence}, doi = {https://doi.org/10.1038/s42256-024-00831-9}, vol = {6}, pages = {515-–524}, pages={1--10}, year={2024}, publisher={Nature Publishing Group UK London} }

Owner

  • Name: Florian Fürrutter
  • Login: FlorianFuerrutter
  • Kind: user
  • Location: Austria, Innsbruck
  • Company: University of Innsbruck

Physics-Student, Software Developer

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Fürrutter
    given-names: Florian
  - family-names: Muñoz-Gil
    given-names: Gorka
  - family-names: Briegel
    given-names: Hans J.
doi: "10.1038/s42256-024-00831-9"
title: "Quantum circuit synthesis with diffusion models"
year: 2024
url: "https://www.nature.com/articles/s42256-024-00831-9"
preferred-citation:
  type: article
  authors:
    - family-names: Fürrutter
      given-names: Florian
    - family-names: Muñoz-Gil
      given-names: Gorka
    - family-names: Briegel
      given-names: Hans J.
  doi: "10.48550/arXiv.2311.02041"
  title: "Quantum circuit synthesis with diffusion models"
  year: 2024
  url: "https://www.nature.com/articles/s42256-024-00831-9"
  volume: 6
  start: 512
  end: 524

GitHub Events

Total
  • Create event: 1
  • Release event: 1
  • Issues event: 5
  • Watch event: 24
  • Issue comment event: 8
  • Push event: 9
  • Pull request event: 2
  • Fork event: 4
Last Year
  • Create event: 1
  • Release event: 1
  • Issues event: 5
  • Watch event: 24
  • Issue comment event: 8
  • Push event: 9
  • Pull request event: 2
  • Fork event: 4

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 1
  • Total pull requests: 3
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 24 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 4.0
  • Average comments per pull request: 1.67
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 3
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 24 days
  • Issue authors: 1
  • Pull request authors: 3
  • Average comments per issue: 4.0
  • Average comments per pull request: 1.67
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • yuzhuovo (1)
  • ACE07-Sev (1)
  • MarcinPlodzien (1)
Pull Request Authors
  • FlorianFuerrutter (3)
  • gzquse (1)
  • zipeilee (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,260 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
pypi.org: genqc

Generative quantum circuits

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,260 Last month
Rankings
Dependent packages count: 10.4%
Average: 34.6%
Dependent repos count: 58.7%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/deploy.yaml actions
  • fastai/workflows/quarto-ghp master composite
.github/workflows/test.yaml actions
  • fastai/workflows/nbdev-ci master composite
setup.py pypi
pyproject.toml pypi