sbi-dev / sbi

Simulation-based inference toolkit
https://sbi-dev.github.io/sbi/
Apache License 2.0
546 stars 133 forks source link

Refactor gpu warnings #1169

Closed janfb closed 3 weeks ago

janfb commented 3 weeks ago

What does this implement/fix? Explain your changes

Refactors warnings related to GPU usage. Fixes a warning about torch.set_default_tensor_type() being deprecated as of PyTorch 2.1.

Does this close any currently open issues?

Fixes #1168

Comment

Does is also fix #1167?

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72.94%. Comparing base (fe55b1c) to head (b78d701). Report is 5 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1169 +/- ## =========================================== - Coverage 83.94% 72.94% -11.00% =========================================== Files 90 93 +3 Lines 6931 7370 +439 =========================================== - Hits 5818 5376 -442 - Misses 1113 1994 +881 ``` | [Flag](https://app.codecov.io/gh/sbi-dev/sbi/pull/1169/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/sbi-dev/sbi/pull/1169/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev) | `72.94% <ø> (-11.00%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/sbi-dev/sbi/pull/1169?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev) | Coverage Δ | | |---|---|---| | [sbi/utils/torchutils.py](https://app.codecov.io/gh/sbi-dev/sbi/pull/1169?src=pr&el=tree&filepath=sbi%2Futils%2Ftorchutils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev#diff-c2JpL3V0aWxzL3RvcmNodXRpbHMucHk=) | `64.93% <ø> (-0.68%)` | :arrow_down: | | [sbi/utils/user\_input\_checks.py](https://app.codecov.io/gh/sbi-dev/sbi/pull/1169?src=pr&el=tree&filepath=sbi%2Futils%2Fuser_input_checks.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev#diff-c2JpL3V0aWxzL3VzZXJfaW5wdXRfY2hlY2tzLnB5) | `83.24% <ø> (ø)` | | ... and [33 files with indirect coverage changes](https://app.codecov.io/gh/sbi-dev/sbi/pull/1169/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sbi-dev)