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

Update logic for enabling grad_on_execution in lightning_*.py devices #1016

Merged
merged 13 commits into from
Dec 4, 2024

Conversation

andrijapau
Copy link
Contributor

@andrijapau andrijapau commented Dec 3, 2024

Context:

In PennyLane, grad_on_execution is expected to be enabled when the gradient method is set to adjoint. Since this is automatically true for Lightning devices, the use_device_gradient flag can serve as an additional condition to decide whether to enable grad_on_execution.

This discrepancy caused certain Lightning device tests to fail during a PennyLane workflow clean-up PR. The issue arose because PennyLane expected grad_on_execution to be None but received True instead. Further details can be found in the PR workflow.

Description of the Change:

Update logic for when grad_on_execution is turned on in lightning device configurations.

Benefits: Unblocks PennyLaneAI/pennylane#6657

Possible Drawbacks: None.
[sc-79648]
[sc-72150]

@andrijapau andrijapau requested a review from albi3ro December 3, 2024 14:49
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 27.86%. Comparing base (158d393) to head (764829f).
Report is 46 commits behind head on master.

Files with missing lines Patch % Lines
pennylane_lightning/lightning_gpu/lightning_gpu.py 0.00% 1 Missing ⚠️
...ane_lightning/lightning_kokkos/lightning_kokkos.py 0.00% 1 Missing ⚠️
...ylane_lightning/lightning_qubit/lightning_qubit.py 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (158d393) and HEAD (764829f). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (158d393) HEAD (764829f)
8 6
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1016       +/-   ##
===========================================
- Coverage   95.85%   27.86%   -68.00%     
===========================================
  Files         229       29      -200     
  Lines       38841     2584    -36257     
===========================================
- Hits        37232      720    -36512     
- Misses       1609     1864      +255     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrijapau andrijapau changed the title Update config handling for lightning_*.py devices Update logic for enabling grad_on_execution in lightning_*.py devices Dec 3, 2024
@andrijapau andrijapau marked this pull request as ready for review December 3, 2024 15:19
@andrijapau andrijapau requested a review from maliasadi December 3, 2024 16:10
Copy link
Member

@maliasadi maliasadi left a comment

Choose a reason for hiding this comment

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

Thanks @andrijapau, LGTM!

@andrijapau andrijapau merged commit f9e8f62 into master Dec 4, 2024
68 of 70 checks passed
@andrijapau andrijapau deleted the fix-devices-config branch December 4, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants