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

Fix postselection Nan sampling with different environment setups #6777

Merged
merged 8 commits into from
Jan 7, 2025

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Jan 7, 2025

Context:

When running tests locally, I was getting failures like:

FAILED tests/devices/default_qubit/test_default_qubit.py::TestPostselection::test_postselection_invalid_finite_shots[shots1-mp2-expected_shape2-False-jax] - ValueError: Probabilities contain NaN

We had logic to catch the error 'probabilities contain NaN', but something about my versioning gives a slightly different capitalization. To prevent this happening of other people, I updated the error catching to be capitalization independent.

Description of the Change:

Catch both "Probabilities contain NaN" and "probabilities contain NaN".

Benefits:

Tests pass locally for my environment.

Possible Drawbacks:

Still a bit error prone. I'm also not sure what about my environment gives different capitalization.

Related GitHub Issues:

github-actions bot and others added 4 commits January 6, 2025 09:46
Automatic update of stable requirement files to snapshot valid python
environments.

Because bots are not able to trigger CI on their own, please do so by
pushing an empty commit to this branch using the following command:

```
git commit --allow-empty -m 'trigger ci'
```

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Created automatically from the `pennylane_version_bump.sh` script.

- **Remove rc0 from version number**
- **Changes to set up 0.41.0 dev branch**

---------

Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
@albi3ro albi3ro requested a review from a team as a code owner January 7, 2025 17:48
@PietropaoloFrisoni PietropaoloFrisoni added this to the v0.40 milestone Jan 7, 2025
Copy link
Contributor

@andrijapau andrijapau left a comment

Choose a reason for hiding this comment

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

Possible alternative suggestion, but otherwise LGTM!

pennylane/devices/qubit/sampling.py Outdated Show resolved Hide resolved
Co-authored-by: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (v0.40.0-rc0@0c2494c). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff               @@
##             v0.40.0-rc0    #6777   +/-   ##
==============================================
  Coverage               ?   99.60%           
==============================================
  Files                  ?      476           
  Lines                  ?    45232           
  Branches               ?        0           
==============================================
  Hits                   ?    45055           
  Misses                 ?      177           
  Partials               ?        0           

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

@albi3ro albi3ro merged commit 22b172b into v0.40.0-rc0 Jan 7, 2025
41 checks passed
@albi3ro albi3ro deleted the sampling-fix branch January 7, 2025 19:21
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.

5 participants