-
Notifications
You must be signed in to change notification settings - Fork 186
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
Fix demos to use jax that require grads #1226
base: dev
Are you sure you want to change the base?
Conversation
👋 Hey, looks like you've updated some demos! 🐘 Don't forget to update the Please hide this comment once the field(s) are updated. Thanks! |
Failures happening in both `dev` and `master` builds due to `ModuleNotFoundError: No module named 'qulacs'`. This PR updates the `qulacs` version in `pyproject.toml` to attempt resolving this issue. [sc-75989]
# In this example, we use the ``default.qubit`` simulator: | ||
num_wires = 6 | ||
dev = qml.device("lightning.qubit", wires=num_wires) | ||
dev = qml.device("default.qubit", wires=num_wires) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason lightning.qubit doesn't work with JAX here. Not sure why but I had to change to using default to get it working.
Adding new profile usernames.
…ton (#1244) For the top 20 most visited demos in 2024, updating the `ask a question on the forum` button url to a unique Discussion Forum thread. Updated demo's `.metadata.json` files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @austingmhuang. before doing a full review, could you please make sure that this PR targets dev
instead of master
? Also, if there is any demo that does not require features in dev
, their upgrade should be done in this PR.
from jax import numpy as jnp | ||
import jax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just use vanilla numpy in this demo.
from pennylane import qchem | ||
from pennylane import numpy as np | ||
from jax import numpy as jnp | ||
|
||
symbols = ['H', 'H'] | ||
geometry = np.array([[0.0, 0.0, -0.69434785], | ||
[0.0, 0.0, 0.69434785]], requires_grad = False) | ||
geometry = jnp.array([[0.0, 0.0, -0.69434785], | ||
[0.0, 0.0, 0.69434785]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demo is already updated in another PR, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not updated in that PR. Well that PR had a one line change in this demo by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demo doesn't work without the requires_grad changes because it calls fermionic_hamiltonian directly
from pennylane import numpy as np | ||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update this demo in this PR as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it cannot be done. This demo calls electronic_integrals()
directly, which checks for requires_grad, leading to an error.
Doesn't build due to the fact that this PR is not yet merged. JSON files need to be updated as well.
Summary:
Fixes remaining demos that checked for requires_grad. Won't build for now due to missing a fix in this PR
[sc-69776] [sc-69778]