Skip to content

Commit

Permalink
Merge branch 'master' into qsvt_fixing_real
Browse files Browse the repository at this point in the history
  • Loading branch information
KetpuntoG authored Sep 5, 2023
2 parents def6195 + a264b0d commit 9c8903f
Show file tree
Hide file tree
Showing 34 changed files with 2,035 additions and 1,206 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ jobs:
# Adding this install outside of poetry as the dependencies conflict with existing other packages.
# TODO: This needs to be revisited.
# The following needs to be done in order for this dependency to be moved into pyproject.toml:
# - PennyLane-Cirq needs to support cirq >= 1.1.0
# - PennyLane needs to support numpy ~> 1.24
${{ steps.venv.outputs.location }}/bin/python3 -m pip install --no-deps mitiq==0.25.0
- name: Download Worker Load Data Artifact
Expand Down Expand Up @@ -432,17 +435,6 @@ jobs:
retention-days: 1
path: /tmp/execution_times

# These are files that are generated as part of sphinx-build but are not needed and supported on the live website
# There does not seem to be an option to "not" generate them, therefore this step deletes these files before they
# are published to the live website.
- name: Update sitemap.xml
run: |
${{ steps.venv.outputs.location }}/bin/qml_pipeline_utils \
clean-sitemap \
--build-dir="${{ github.workspace }}/_build/html" \
--html-files="demos/sg_execution_times.html" \
--verbose
# Removes built html files that are not relevant to current node
# See documentation in github_job_scheduler.py for more details.
- name: Clean HTML Files
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ Add the new dependency in the `[tool.poetry.group.executable-dependencies.depend

Once pyproject.toml files have been updated, the poetry.lock file needs to be refreshed:
```bash
poetry lock
poetry lock --no-update
```
This command will ensure that there are no dependency conflicts with any other package, and everything works.

The `--no-update` ensures existing package versions are not bumped as part of the locking process.

If the dependency change is required in prod, open the PR against `master`, or if it's only required in dev, then open
the PR against the `dev` branch, which will be synced to master on the next release of PennyLane.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx_gallery.gen_gallery",
"sphinx_sitemap",
"sphinx_gallery.gen_gallery"
]


Expand Down
2 changes: 1 addition & 1 deletion demonstrations/ahs_aquila.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def circuit(params):
start_val = amplitude[0]
stop_val = amplitude[-1]
max_val = np.max(amplitude)
max_rate = np.max([(amplitude[i + 1] - amplitude[i]) / timestep for i in range(len(times))])
max_rate = np.max([(amplitude[i + 1] - amplitude[i]) / timestep for i in range(len(times)-1)])

print(f"start value: {start_val:.3} MHz")
print(f"stop value: {stop_val:.3} MHz")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/contextuality/model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/contextuality/rps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demonstrations/contextuality/rpstable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions demonstrations/ibm_pennylane.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*Authors: Kaur Kristjuhan, Clara Ferreira Cores, Mark Nicholas Jones; Molecular Quantum Solutions (MQS) — Posted: 20 June 2023. Last updated: 20 June 2023.*
.. warning::
This demo currently does not work as the Qiskit Runtime VQE program has been retired.
Bigger and better quantum computers are built every year. Instead of waiting for the perfect quantum computer to be
released, we can already try out the best hardware that exists today. Experimenting on cutting-edge devices helps us
understand the technology and improve the way we develop quantum software. PennyLane is a fantastic tool for prototyping
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/quantum_neural_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def quantum_neural_net(var, x):
for v in var:
layer(v)

return qml.expval(qml.X(0))
return qml.expval(qml.QuadX(0))


##############################################################################
Expand Down
6 changes: 3 additions & 3 deletions demonstrations/tutorial_QGAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def gen_cost(gen_weights):
# We begin by creating the optimizer:

opt = tf.keras.optimizers.SGD(0.4)

opt.build([disc_weights, gen_weights])

##############################################################################
# In the first stage of training, we optimize the discriminator while
Expand All @@ -213,7 +213,7 @@ def gen_cost(gen_weights):
cost = lambda: disc_cost(disc_weights)

for step in range(50):
opt.minimize(cost, disc_weights)
opt.minimize(cost, [disc_weights])
if step % 5 == 0:
cost_val = cost().numpy()
print("Step {}: cost = {}".format(step, cost_val))
Expand Down Expand Up @@ -243,7 +243,7 @@ def gen_cost(gen_weights):
cost = lambda: gen_cost(gen_weights)

for step in range(50):
opt.minimize(cost, gen_weights)
opt.minimize(cost, [gen_weights])
if step % 5 == 0:
cost_val = cost().numpy()
print("Step {}: cost = {}".format(step, cost_val))
Expand Down
2 changes: 1 addition & 1 deletion demonstrations/tutorial_apply_qsvt.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def real_u(A, phi):

@qml.qnode(qml.device("default.qubit", wires=["ancilla1", "ancilla2", 0, 1, 2]))
def linear_system_solver_circuit(phi):
qml.QubitStateVector(normalized_b, wires=[1, 2])
qml.StatePrep(normalized_b, wires=[1, 2])
real_u(A.T, phi) # invert the singular values of A transpose to get A^-1
return qml.state()

Expand Down
83 changes: 83 additions & 0 deletions demonstrations/tutorial_contextuality.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"title": "Contextuality and inductive bias in QML",
"authors": [
{
"id": "joseph_bowles"
}
],
"dateOfPublication": "2023-09-06T00:00:00+00:00",
"dateOfLastModification": "2023-09-06T00:00:00+00:00",
"categories": [
"Quantum Machine Learning"
],
"tags": [],
"previewImages": [
{
"type": "thumbnail",
"uri": "/_images/thumbnail_tutorial_Contextuality.png"
},
{
"type": "large_thumbnail",
"uri": "/_static/large_demo_thumbnails/thumbnail_large_Contextuality.png"
}
],
"seoDescription": "Train a problem-inspired ansatz on a contextuality-inspired dataset.",
"doi": "",
"canonicalURL": "/qml/demos/tutorial_contextuality",
"references": [
{
"id": "paper",
"type": "article",
"title": "Contextuality and inductive bias in quantum machine learning.",
"authors": "J. Bowles, V. J. Wright, M. Farkas, N. Killoran, M. Schuld",
"year": "2023",
"journal": "",
"url": "https://arxiv.org/abs/2302.01365"
},
{
"id": "contextuality",
"type": "article",
"title": "Contextuality for preparations, transformations, and unsharp measurements.",
"authors": "R. W. Spekkens",
"year": "2005",
"journal": "Phys. Rev. A 71",
"url": "https://journals.aps.org/pra/abstract/10.1103/PhysRevA.71.052108"
},
{
"id": "reptheory",
"type": "article",
"title": "Representation Theory for Geometric Quantum Machine Learning.",
"authors": "M. Ragone, P. Braccia, Q. T. Nguyen, L. Schatzki, P. J. Coles, F. Sauvage, M. Larocca, M. Cerezo",
"year": "2023",
"journal": "",
"url": "https://arxiv.org/abs/2210.07980"
},
{
"id": "equivariant",
"type": "article",
"title": "Theory for Equivariant Quantum Neural Networks.",
"authors": "Q. T. Nguyen, L. Schatzki, P. Braccia, M. Ragone, P. J. Coles, F. Sauvage, M. Larocca, M. Cerezo",
"year": "2022",
"journal": "",
"url": "https://arxiv.org/abs/2210.08566"
},
{
"id": "surrogates",
"type": "article",
"title": "Classical surrogates for quantum learning models.",
"authors": "F. J. Schreiber, J. Eiser, J. J. Meyer",
"year": "2022",
"journal": "",
"url": "https://arxiv.org/abs/2206.11740"
}
],
"basedOnPapers": [],
"referencedByPapers": [],
"relatedContent": [
{
"type": "demonstration",
"id": "tutorial_geometric_qml",
"weight": 1.0
}
]
}
Loading

0 comments on commit 9c8903f

Please sign in to comment.