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

[sc-63358] How to use Qiskit 1.0 with PennyLane #1104

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

isaacdevlugt
Copy link
Contributor

@isaacdevlugt isaacdevlugt commented May 15, 2024

@isaacdevlugt isaacdevlugt changed the title initial How to use Qiskit 1.0 with PennyLane May 15, 2024
Copy link

👋 Hey, looks like you've updated some demos!

🐘 Don't forget to update the dateOfLastModification in the associated metadata files so your changes are reflected in Glass Onion (search and recommendations).

Please hide this comment once the field(s) are updated. Thanks!

Copy link

github-actions bot commented May 15, 2024

Thank you for opening this pull request.

You can find the built site at this link.

Deployment Info:

  • Pull Request ID: 1104
  • Deployment SHA: 33451d317d1810e5e4c831e38fec68f5bd92a656
    (The Deployment SHA refers to the latest commit hash the docs were built from)

Note: It may take several minutes for updates to this pull request to be reflected on the deployed site.

@isaacdevlugt isaacdevlugt changed the title How to use Qiskit 1.0 with PennyLane [sc-63358] How to use Qiskit 1.0 with PennyLane Jun 12, 2024
@isaacdevlugt isaacdevlugt added the Completed/Ready This label is intended for demos that have been finalized but not yet merged label Jun 19, 2024
Copy link
Contributor

@ikurecic ikurecic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing, @isaacdevlugt !

demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
Comment on lines +152 to +153
# Let’s say you’ve created the following Qiskit code that prepares a modified GHZ state for an
# arbitrary amount of qubits, measures several expectation values of ``SparsePauliOp`` operators.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the 3-step process here would be easier to visually scan through if you actuall make subsections for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with that is that there's no "X step process" in general for doing this. We could use the from_qiskit and from_qiskit_op functions in any order and still get the same outcome. I think the 2-point bulleted list above is probably fine?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
@@ -0,0 +1,430 @@
r"""How to use Qiskit 1.0 with PennyLane
====================================

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unresolving this because it's a how-to instead of a demo. It should be quick to get to the 'meat' and set expectations. Are you sure there's no way you would want to cut it down a little bit?

demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved
@ikurecic
Copy link
Contributor

ikurecic commented Jun 26, 2024

Another question I have is about emoji in section titles.
image
I don't recall ever using this approach in PennyLane Demos. Am I missing something, @isaacdevlugt ?
Also, removing them might help with some of the rendering issues for the time being.

demonstrations/how_to_use_qiskit1_with_pennylane.py Outdated Show resolved Hide resolved

import pennylane as qml

dev = qml.device("qiskit.basicsim", wires=2, shots=1024)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not a blocking comment for this PR) Maybe a question to @austingmhuang - is wires a required argument for the new devices? Like default.qubit, it feels like we could make it optional, with the wires inferred at runtime.

Copy link
Contributor

@austingmhuang austingmhuang Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wires is a required argument but you could make it optional by inferring the # of wires either off the real hardware backend chosen or, for simulators, the circuit itself I imagine.

Comment on lines +25 to +27
# This will install PennyLane, the plugin, and the latest Qiskit 1.0 version that the plugin supports.
# If you use an environment that contains a pre-1.0 version of Qiskit, upgrading to Qiskit 1.0 could
# cause issues. In that case, we recommend following `Qiskit's upgrade instructions <https://docs.quantum.ibm.com/start/install>`__.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Completed/Ready This label is intended for demos that have been finalized but not yet merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants