GithubHelp home page GithubHelp logo

tutorial-qml's Introduction

Tutorial-qml

This tutorial contains four labs on Quantum Machine Learning for Generative Modeling. The three labs should be done in order:

  1. Lab 1: Fair and Biased Coin Toss
  2. Lab 2: 2 Qubit entanglement Generator
  3. Lab 3: 4 Qubit entanglement Generator
  4. Lab 4: Quantum Circuit Born Machine (QCBM)

For Lab 3, we have two helper scripts for utility functions (utils.py) and our classical optimizer (pso.py). Please make sure these are in the same folder as the Lab 3 script in order to ensure that you can import functions from these scripts.

Installation

Installation Requirements:

  • Python 3.7 (at least)
  • Python Package NumPy
  • Python Package random2
  • Python Package Matplotlib
  • Jupyter Lab or Notebook
  • PyQuil (Version 2.28.2)
  • Quilc
  • Rigetti QVM

Installation Instructions:

If not already installed, please install at least Python Version 3.7. Instructions on installing Python can be found here: https://www.python.org/downloads/. Along with Python 3.7, please install the Python package NumPy. Instructions can be found here: https://numpy.org/install/. Please install the package random2 with instructions found here: https://pypi.org/project/random2/. Please install the package Matplotlib with instructions found here: https://pypi.org/project/matplotlib/.

If not already installed, please install Jupyter Notebook or Jupyter Lab prior to this workshop. Instructions on installing Jupyter can be found here: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html.

You can utilize the package manager 'pip' to install Jupyter Lab with 'pip install jupyterlab'.

The last thing you'll need to install is PyQuil. PyQuil is a Python library for quantum programming using Quil, the quantum instruction language developed at Rigetti Computing. Installation instructions can be found here: https://pyquil-docs.rigetti.com/en/stable/start.html.

PyQuil can be installed using 'pip install pyquil'. PyQuil, along with quilc, the QVM, and other libraries, make up what is called the Forest SDK. To make full use of pyQuil, you will need to additionally have installed quilc and the Quantum Virtual Machine (QVM). These can be downloaded together directly from here: https://qcs.rigetti.com/sdk-downloads.

Note: This lab only works with pyquil version 2.28.2. To install this, use the line pip install pyquil==2.28.2

Give it a Try!

Prior to the workshop, try opening your Jupyter Notebook/Lab and make sure everything runs.

First, open up two separate terminal windows for the quilc compiler and the qvm. In the first terminal type 'qvm -S'. In the second terminal type 'quilc -S'

Then input the following code into your Jupyter Notebook:

#load the necessary packages and libraries from pyquil.quil import Program import pyquil.api as api from pyquil.gates import * import matplotlib.pyplot as plt import time import itertools import numpy as np import math qvm = api.QVMConnection()

If no errors pop up when you run it, you're good to go! Looking forward to seeing you at the workshop!

tutorial-qml's People

Contributors

kaitlinmgili avatar luisguiserrano 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.