PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.32k stars 595 forks source link

[BUG] Loading the MQT Bench dataset does not work as expected. #6035

Open vbrodeur opened 2 months ago

vbrodeur commented 2 months ago

Expected behavior

1 - Running qml.data.load("other", name="mqt-bench") returns the dataset. 2 - Running qml.data.load("other", name="mqt-bench", attributes=["ae"]) returns the "ae" algorithm from the dataset (same behavior for all algorithms)

These lines are from the MQT Bench dataset documentation, in the download button.

Actual behavior

1 - Running qml.data.load("other", name="mqt-bench") returns an array of 1 element where the element is the dataset. 2 - Running qml.data.load("other", name="mqt-bench", attributes=["ae"]) gives the error ValueError: 'ae' is an invalid attribute for 'other'. Valid attributes are: [] ( again, same behavior for all algorithms)

Additional information

To access a single algorithm, the way around this that I'm using is to first load the whole dataset by accessing the element of the array with ds=qml.data.load("other", name="mqt-bench")[0] and then select the algorithm from the dataset with ds.ae.

Downsides of this method :

Source code

#working
ds = qml.data.load("other", name="mqt-bench")[0]
algo=ds.ae
print("dataset:", ds)
print("algo:", algo)

#not working
ds = qml.data.load("other", name="mqt-bench")
algo=qml.data.load("other", name="mqt-bench", attributes=["ae"])
print("dataset:", ds)
print("algo:", algo)

Tracebacks

No response

System information

Name: PennyLane
Version: 0.37.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: C:\Users\Username\AppData\Roaming\Python\Python312\site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: PennyLane-qiskit, pennylane-snowflurry, PennyLane_Lightning

Platform info:           Windows-10-10.0.19045-SP0
Python version:          3.12.2
Numpy version:           1.26.4
Scipy version:           1.13.1
Installed devices:
- default.clifford (PennyLane-0.37.0)
- default.gaussian (PennyLane-0.37.0)
- default.mixed (PennyLane-0.37.0)
- default.qubit (PennyLane-0.37.0)
- default.qubit.autograd (PennyLane-0.37.0)
- default.qubit.jax (PennyLane-0.37.0)
- default.qubit.legacy (PennyLane-0.37.0)
- default.qubit.tf (PennyLane-0.37.0)
- default.qubit.torch (PennyLane-0.37.0)
- default.qutrit (PennyLane-0.37.0)
- default.qutrit.mixed (PennyLane-0.37.0)
- default.tensor (PennyLane-0.37.0)
- null.qubit (PennyLane-0.37.0)
- qiskit.aer (PennyLane-qiskit-0.37.0)
- qiskit.basicaer (PennyLane-qiskit-0.37.0)
- qiskit.basicsim (PennyLane-qiskit-0.37.0)
- qiskit.ibmq (PennyLane-qiskit-0.37.0)
- qiskit.ibmq.circuit_runner (PennyLane-qiskit-0.37.0)
- qiskit.ibmq.sampler (PennyLane-qiskit-0.37.0)
- qiskit.remote (PennyLane-qiskit-0.37.0)
- lightning.qubit (PennyLane_Lightning-0.37.0)
- snowflurry.qubit (pennylane-snowflurry-0.2.1)

Existing GitHub issues

DSGuala commented 2 months ago

Hi @vbrodeur! Thanks for putting this together!

We're aware of this issue, but enabling the attribute-download functionality requires making a few structural changes in how we store and access the datasets. We are planning to take this work on between now and the end of the year, along with other dataset improvements.

I will reply here again when we have a clearer timeline.