Skip to content

This workshop provides an introduction to Quantum Machine Learning using PennyLane and PyTorch, with hands-on exercises and take-home challenges. The workshop includes four practical sessions that cover the QML concepts, models, and techniques.

License

Notifications You must be signed in to change notification settings

ironfrown/qml_workshop_intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An introduction to QML in PennyLane (PL) and PyTorch

  • Author: Jacob Cybulski (LinkedIn), Enquanted
  • Collaboration with: Sebastian Zając (LinkedIn), Tomasz Rybotycki (LinkedIn) and Paweł Gora (LinkedIn)
  • Associated with: QPoland and Quantum AI Foundation
  • Aims: To explore the creation and use of quantum machine learning models in PennyLane and PyTorch.
  • Description: This Quantum Machine Learning (QML) workshop provides an introduction to Quantum Machine Learning using PennyLane and PyTorch, with hands-on exercises and take-home challenges. The workshop includes four practical sessions that cover the QML concepts, models, and techniques. The sessions explore development of quantum estimators and classifiers, their training with various optimisers, loss and cost functions, as well as model testing and scoring using variety of metrics. It finally, explains how to create hybrid quantum-classical QML models.
  • Structure: Four sessions over two days, i.e.
    • Session 1: QML foundation (basic)
    • Session 2: Quantum estimators (intermediate)
    • Session 3: Quantum classifiers (intermediate)
    • Session 4: Hybrid models (advanced)
  • Release Date:
    • April, 11 2025: The final versions will be made available 1 day before the workshop
  • Last Update:
    • April 06, 2025: Sessions 1-4 completed, all challenges added, sample answers after sessions
    • April 07, 2025: Small updates (README)

Important notebooks

You can play with these notebooks, enjoy!
Note however that they may be updated at any time!

Session File Description
Explore 1 s00_explore_tiny_model_vX_x.ipynb Explains QML principles using PL
Explore 2 s00_explore_meas_tests_vX_x.ipynb Explains data encoding and measurements in PL
Session 1 s01_simple_model_vX_x.ipynb Creates and tests a very simple quantum model
Session 2 s02_medium_qestimator_vX_x.ipynb Creates and tests a more complex quantum estimator
Session 3 s03_medium_qclassifier_vX_x.ipynb (creates and tests a quantum classifier
s03_medium_cclassifier_vX_x.ipynb Creates and tests a classical classifier
Session 4 s04_advanced_hybrid_vX_x.ipynb Creates and tests a quantum-classical hybrid model
s04_challenge_qreservoir_vX_x.ipynb Hard challenge to create a PyTorch quantum reservoir
s04_challenge_creservoir_vX_x.ipynb Reference for the challenge - classical reservoir in Python
Other utilities.py A number of useful plotting functions to make your life easier
requirements.txt A list of software needed for this workshop (for auto-install with pip)

Folders

  • images: some images appearing in notebooks (via a relative link)
  • legacy: previous versions of files (in case you really really wanted them)
  • slides: presentation slides in PDF (as they become available)

Requirements

  • Set up a virtual environment with venv or anaconda for Python 3.11 and activate it
  • Then install all software using requirements.txt file (available here):
    • pip install -r <place-you-saved-it>/requirements.txt
  • Or install by hand by following these instructions:
    • pip install pennylane==0.40.0 pennylane-lightning==0.40.0 (PennyLane for CPU)
    • pip install scikit-learn==1.6.1 pandas==2.2.3 (ML)
    • pip install matplotlib==3.10.1 plotly==6.0.0 seaborn==0.13.2 pillow==11.1.0 (plots and images)
    • pip install jupyter==1.1.1 jupyterlab==4.3.5 (running jupyter notebooks)
    • pip install kagglehub==0.3.10 ucimlrepo==0.0.7 (data access)
    • pip install pdflatex (optionally to plot and export some plots and tables to latex)
    • install PyTorch, as per web site instructions, also add:
      pip install torchsummary torcheval torchmetrics

The requirements.txt file was tested for installation on Ubuntu 22.04-24.04, Windows 11 and MacOS Sequoia 15.3.1 (with M3 procesor).

License

This project is licensed under the GNU General Public License v3. The GPL v3 license requires attribution for modifications and derivatives, ensuring that users know which versions are changed and to protect the reputations of original authors.

About

This workshop provides an introduction to Quantum Machine Learning using PennyLane and PyTorch, with hands-on exercises and take-home challenges. The workshop includes four practical sessions that cover the QML concepts, models, and techniques.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published