Maximilian Krahn1,2, Michele Sasdelli3, Fengyi Yang3, Vladislav Golyanik4, Juho Kannala1, Tat-Jun Chin3 and Tolga Birdal2
1 Aalto University , 2Imperial College London, 3 Adelaide University, 4 Max Plank Institute for Informatics.
This is the official repository for the project "Projected Stochastic Gradient Descent with Quantum Annealed Binary Gradients". In this work, we train binary neural networks with a quantum annealer deployable optimiser. The preprint can be found at https://arxiv.org/abs/2310.15128 and the project page can be found here. The code can be executed with PyTorch and the D-Wave ocean sdk. To run the code without a quantum annealer one can use D-Wave neal instead of a QPU Sampler or look at the experiments with gurobi.
- The repository can be cloned with
git clone https://github.com/mk2510/QPSBGD/
- We recommend the user to set up a conda environment with
conda create --name QPSBGD --file requirements.txt
-
The D-Wave ocean sdk can be installed with
python -m pip install dwave-ocean-sdk
and following the steps from https://docs.ocean.dwavesys.com/en/stable/overview/install.html. In particular to get access to the solvers from D-Wave one has to create an account for D-Wave Leap (https://cloud.dwavesys.com/leap/login/?next=/leap/) and can then use the API Token (https://docs.ocean.dwavesys.com/en/stable/overview/sapi.html). We tested the code for dwave-ocean-sdk versions 4.2 and 6.3. -
Installing Gurobi is another prerequisite. Please refer to the homepage to acquire a license.
To reproduce the experiments of the paper it is required to download the datasets:
wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/a1a
wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/a1a
place those files in the folder datafolder
.
The experiments are then executed by running the 10layers.ipynb
file.
To reproduce the experiments of the paper it is required to download the datasets:
wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/a1a
wget https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/a1a
place those files in the folder datafolder
.
The experiments are then executed by running the 2layers.ipynb
file.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.