Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v0.31.1-rc0 branch into master #4428

Merged
merged 37 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
89535a4
Support `HardwareHamiltonian` pulses in `stoch_pulse_grad` (#4215)
dwierichs Jun 19, 2023
7f89102
Fix batching of derivative tapes in autograd (#4245)
albi3ro Jun 19, 2023
ecd9393
Fix `expval` of `Sum` with broadcasting (#4275)
dwierichs Jun 20, 2023
0df4cb4
Various doc fixes (#4268)
eddddddy Jun 20, 2023
b3e1f10
Various things while validating changes for 0.31 (#4279)
timmysilv Jun 21, 2023
fc0c3f7
rename string function (#4278)
soranjh Jun 21, 2023
975d1e9
Update docs (#4269)
lillian542 Jun 21, 2023
1756f40
Minor fixes for v0.31 (#4280)
mudit2812 Jun 21, 2023
32fe37d
add graphviz to RTD apt packages (#4284)
timmysilv Jun 21, 2023
b510053
Pulse gradient methods docs polish (#4282)
Qottmann Jun 22, 2023
0d656e2
0.31 release notes (#4218)
trbromley Jun 22, 2023
14aa985
Allow updating dense kwarg in call of ParametrizedEvolution (#4285)
lillian542 Jun 22, 2023
4459546
Remove line in code example to make docs render properly. (#4290)
frederikwilde Jun 22, 2023
cfb8578
Pin autograd to <= 1.5 (#4289)
timmysilv Jun 22, 2023
a0980c1
Add dm_from_state_vector function to qml.math docs page. (#4291)
frederikwilde Jun 22, 2023
41fd912
Fix `ShotAdaptiveOptimizer` to prevent removing shot vector axes (#4240)
mudit2812 Jun 22, 2023
ef75ed7
Make links to qml.eigvals and the eigvals method appear distinctly. (…
frederikwilde Jun 23, 2023
487f92e
Device API review (#4283)
BorjaRequena Jun 23, 2023
6a9f9fc
remove duplicate controlled operation entries (#4298)
BorjaRequena Jun 23, 2023
996730f
Refer to class QNode in ml layers (#4299)
BorjaRequena Jun 23, 2023
d9779ed
Specs dict fix (#4286)
frederikwilde Jun 23, 2023
f29bf32
Fermionic ops in changelog (#4302)
trbromley Jun 26, 2023
18603e2
bump lightning to 0.31 in setup.py, pin scipy to [1.8,1.10] (#4304)
timmysilv Jun 26, 2023
de4dbbe
Implement new Dataset class using HDF5 (#4369)
eddddddy Jul 25, 2023
aa20595
Make qchem compatible with scipy factorial2 (#4387)
eddddddy Jul 25, 2023
901db49
Release notes and version bump (#4385)
eddddddy Jul 25, 2023
f62974a
pin autoray (#4399)
eddddddy Jul 27, 2023
30cf7a0
raise error with actual identifier name (#4405)
timmysilv Jul 28, 2023
6c7df30
Escape special characters in Dataset URL (#4412)
brownj85 Jul 31, 2023
706e6df
BUGFIX: ensure that operators are not queued upon deserialization (#4…
timmysilv Jul 31, 2023
ff87866
Updated the datasets docs (#4400)
josh146 Aug 1, 2023
f91811d
Fix error message when successively loading the same dataset (#4422)
brownj85 Aug 1, 2023
0905217
Fix Attribute Error when accessing identifiers on partial dataset (#4…
brownj85 Aug 1, 2023
a1538d1
merge with master
albi3ro Aug 2, 2023
0b15f35
Update tests/tape/test_qscript.py
albi3ro Aug 2, 2023
c3ad401
Update setup.py
albi3ro Aug 2, 2023
0508d23
Update requirements.txt
albi3ro Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ exclude_lines =
# Ignore things that would have trivial tests
def version

# Ignore overload stubs
@overload


ignore_errors = True

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
- uses: PennyLaneAI/sphinx-action@master
with:
docs-folder: "doc/"
pre-build-command: "apt install -y graphviz && pip3 install -r doc/requirements.txt && pip3 install . pip3 install openfermionpyscf && pip3 install dill zstd"
pre-build-command: "apt install -y graphviz && pip3 install -r doc/requirements.txt && pip3 install . pip3 install openfermionpyscf && pip3 install aiohttp fsspec h5py"
build-command: "sphinx-build -b html . _build -W --keep-going"
2 changes: 1 addition & 1 deletion .github/workflows/interface-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ jobs:
install_pennylane_lightning_master: false
pytest_coverage_flags: ${{ inputs.pytest_coverage_flags }}
pytest_markers: data
additional_pip_packages: zstd dill
additional_pip_packages: h5py


device-tests:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ benchmark/revisions/
venv
config.toml
.envrc
datasets/*
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ignore:
- "pennylane/devices/tests/*"
- "pennylane/data/base/_lazy_modules.py"

codecov:
notify:
Expand Down
5 changes: 2 additions & 3 deletions doc/code/qml_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ qml.data

.. currentmodule:: pennylane.data

.. automodapi:: pennylane.data
:no-heading:
:no-inherited-members:
.. automodule:: pennylane.data

68 changes: 29 additions & 39 deletions doc/introduction/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ where the quantum dataset is a collection of `quantum data` obtained from variou

.. note::

The packages ``zstd`` and ``dill`` are required to use the :mod:`~pennylane.data` module.
These can be installed with ``pip install zstd dill``.

.. warning::
The packages ``aiohttp``, ``fsspec``, and ``h5py`` are required to use the :mod:`~pennylane.data` module.
These can be installed with:
.. code-block:: console

PennyLane datasets use the ``dill`` module to compress, store, and read data. Since ``dill``
is built on the ``pickle`` module, we reproduce an important warning from the ``pickle``
module: it is possible to construct malicious pickle data which will execute arbitrary code
during unpickling. Never unpickle data that could have come from an untrusted source, or
that could have been tampered with.
pip install aiohttp fsspec h5py

Loading Datasets in PennyLane
-----------------------------
Expand All @@ -35,20 +31,22 @@ The :func:`~pennylane.data.load` function returns a ``list`` with the desired da

>>> H2datasets = qml.data.load("qchem", molname="H2", basis="STO-3G", bondlength=1.1)
>>> print(H2datasets)
[<Dataset = description: qchem/H2/STO-3G/1.1, attributes: ['molecule', 'hamiltonian', ...]>]
[<Dataset = molname: H2, basis: STO-3G, bondlength: 1.1, attributes: ['basis', 'basis_rot_groupings', ...]>]
>>> H2data = H2datasets[0]

We can load datasets for multiple parameter values by providing a list of values instead of a single value.
To load all possible values, use the special keyword "full".
To load all possible values, use the special value :const:`~pennylane.data.FULL` or the string ``"full"``:

>>> H2datasets = qml.data.load("qchem", molname="H2", basis="full", bondlength=[0.5, 1.1])
>>> print(H2datasets)
[<Dataset = description: qchem/H2/6-31G/0.5, attributes: ['molecule', 'hamiltonian', ...]>,
<Dataset = description: qchem/H2/6-31G/1.1, attributes: ['molecule', 'hamiltonian', ...]>,
<Dataset = description: qchem/H2/STO-3G/0.5, attributes: ['molecule', 'hamiltonian', ...]>,
<Dataset = description: qchem/H2/STO-3G/1.1, attributes: ['molecule', 'hamiltonian', ...]>]

When we only want to download portions of a large dataset, we can specify the desired properties (referred to as `attributes`).
[<Dataset = molname: H2, basis: STO-3G, bondlength: 0.5, attributes: ['basis', 'basis_rot_groupings', ...]>,
<Dataset = molname: H2, basis: STO-3G, bondlength: 1.1, attributes: ['basis', 'basis_rot_groupings', ...]>,
<Dataset = molname: H2, basis: CC-PVDZ, bondlength: 0.5, attributes: ['basis', 'basis_rot_groupings', ...]>,
<Dataset = molname: H2, basis: CC-PVDZ, bondlength: 1.1, attributes: ['basis', 'basis_rot_groupings', ...]>,
<Dataset = molname: H2, basis: 6-31G, bondlength: 0.5, attributes: ['basis', 'basis_rot_groupings', ...]>,
<Dataset = molname: H2, basis: 6-31G, bondlength: 1.1, attributes: ['basis', 'basis_rot_groupings', ...]>]

When we only want to download portions of a large dataset, we can specify the desired properties (referred to as 'attributes').
For example, we can download or load only the molecule and energy of a dataset as follows:

>>> part = qml.data.load("qchem", molname="H2", basis="STO-3G", bondlength=1.1,
Expand All @@ -61,16 +59,20 @@ For example, we can download or load only the molecule and energy of a dataset a
To determine what attributes are available for a type of dataset, we can use the function :func:`~pennylane.data.list_attributes`:

>>> qml.data.list_attributes(data_name="qchem")
["molecule",
"hamiltonian",
"sparse_hamiltonian",
...
"tapered_hamiltonian",
"full"]
['molname',
'basis',
'bondlength',
...
'vqe_params',
'vqe_energy']

.. note::

"full" is the default value for ``attributes``, and it means that all available attributes for the Dataset will be downloaded.
The default values for attributes are as follows:

- Molecules: ``basis`` is the smallest available basis, usually ``"STO-3G"``, and ``bondlength`` is the optimal bondlength for the molecule or an alternative if the optimal is not known.

- Spin systems: ``periodicity`` is ``"open"``, ``lattice`` is ``"chain"``, and ``layout`` is ``1x4`` for ``chain`` systems and ``2x2`` for ``rectangular`` systems.

Using Datasets in PennyLane
---------------------------
Expand Down Expand Up @@ -139,9 +141,9 @@ array([-1.5, -0.5, 0.5, 1.5])
We can then write this :class:`~pennylane.data.Dataset` to storage and read it as follows:


>>> dataset.write("./path/to/dataset.dat")
>>> dataset.write("./path/to/dataset.h5")
>>> read_dataset = qml.data.Dataset()
>>> read_dataset.read("./path/to/dataset.dat")
>>> read_dataset.read("./path/to/dataset.h5")
>>> read_dataset.data_name
"Example"
>>> read_dataset.hamiltonian
Expand All @@ -155,19 +157,6 @@ array([-1.5, -0.5, 0.5, 1.5])
Quantum Datasets Functions and Classes
--------------------------------------

Classes
^^^^^^^

.. autosummary::
:nosignatures:

~pennylane.data.Dataset

:html:`</div>`

Functions
^^^^^^^^^

:html:`<div class="summary-table">`

.. autosummary::
Expand All @@ -177,5 +166,6 @@ Functions
~pennylane.data.list_attributes
~pennylane.data.load
~pennylane.data.load_interactive
~pennylane.data.Dataset

:html:`</div>`
2 changes: 1 addition & 1 deletion doc/releases/changelog-0.31.0.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:orphan:

# Release 0.31.0 (current release)
# Release 0.31.0

<h3>New features since last release</h3>

Expand Down
25 changes: 25 additions & 0 deletions doc/releases/changelog-0.31.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
:orphan:

# Release 0.31.1 (current release)

<h3>Improvements 🛠</h3>

* `data.Dataset` now uses HDF5 instead of dill for serialization.
[(#4097)](https://github.com/PennyLaneAI/pennylane/pull/4097)

* The `qchem` functions `primitive_norm` and `contracted_norm` are modified to
be compatible with higher versions of scipy.
[(#4321)](https://github.com/PennyLaneAI/pennylane/pull/4321)

<h3>Bug Fixes 🐛</h3>

* Dataset URLs are now properly escaped when fetching from S3.
[(#4412)](https://github.com/PennyLaneAI/pennylane/pull/4412)

<h3>Contributors ✍️</h3>

This release contains contributions from (in alphabetical order):

Utkarsh Azad,
Jack Brown,
Soran Jahangiri
2 changes: 1 addition & 1 deletion docker/pennylane.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN pip install pytest pytest-cov pytest-mock flaky
RUN pip install -i https://test.pypi.org/simple/ pennylane-lightning --pre --upgrade
# hotfix, remove when pyscf 2.1 is released (currently no wheel for python3.10)
RUN pip install openfermionpyscf || true
RUN pip install dill zstd || true
RUN pip install hdf5 fsspec aiohttp || true
RUN make test && make coverage

# create Second small build.
Expand Down
3 changes: 2 additions & 1 deletion pennylane/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,14 @@
from pennylane.vqe import ExpvalCost
from pennylane.debugging import snapshots
from pennylane.shadows import ClassicalShadow
import pennylane.data
import pennylane.pulse

import pennylane.gradients # pylint:disable=wrong-import-order
import pennylane.qinfo # pylint:disable=wrong-import-order
from pennylane.interfaces import execute # pylint:disable=wrong-import-order

import pennylane.data

# Look for an existing configuration file
default_config = Configuration("config.toml")

Expand Down
Loading
Loading