Repository navigation
Feature : LC2ST MLP GPU support (closes : #1160) - #1715
Conversation
|
Hi @Dev-Sudarshan, Thank you for this contribution adding GPU support to LC2ST! Apologies for the long silence on this PR. Note: This PR contains some unrelated PyMC version pinning changes. Please remove those by rebasing on main so we can focus on the GPU support implementation. I've done a review and found the following issues: Issues Found
Current: Fix: (Keep
The
The current implementation only checks for CUDA. Please add MPS support (for Apple Silicon) and refactor to use a generic use_gpu pattern: Similarly, update the RandomForest warning to check for device.lower() in ('cuda', 'mps').
When a user explicitly requests device="cuda" (or "mps") but that backend isn't available, the code silently falls back to
Instead of running the lc2st device test on both cpu and gpu, restrict it to GPU by adding a marker decorator: and testing only cuda and mps (if available). Thanks again for working on this feature – the overall approach using Let me know if you have any questions about the feedback above. |
|
Thank you for the feedback. I will review everything thoroughly and make the required changes. |
505ec2d to
a41a52f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1715 +/- ##
==========================================
- Coverage 88.54% 88.43% -0.11%
==========================================
Files 137 137
Lines 11515 11547 +32
==========================================
+ Hits 10196 10212 +16
- Misses 1319 1335 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
I have implemented all the changes as per your suggestions, including refactoring the MLP module to metrics.py, fixing the input_dim, adding MPS support, and cleaning the git history. While running tests/lc2st_test.py, I encountered the following failure: FAILED tests/lc2st_test.py::test_lc2st_false_positiv_rate[LC2ST_NF] - AssertionError: LC2ST p-values too small, test should be rejected less then 5.00% of the time, but was rejected 24.00% of the time. I verified that this failure is pre-existing by resetting to a clean upstream/main and confirming the test fails identically there. This PR introduces no regressions to that baseline. |
janfb
left a comment
There was a problem hiding this comment.
Thanks for the updates @Dev-Sudarshan !
I added a couple of minor comments, otherwise it looks very good!
Regarding the test error: I can confirm that they fail on main, that's fine for now.
| """PyTorch implementation of a fully-connected multilayer perceptron (MLP) | ||
| with similar training dynamics.""" | ||
|
|
||
| def __init__(self, input_dim, hidden_layer_sizes, output_dim=2): |
There was a problem hiding this comment.
please add types and docstrings throughout.
|
I will revert all the notebook related changes .I didn’t add those manually, they must have slipped in during merge/rebase. |
janfb
left a comment
There was a problem hiding this comment.
Looks all good, can be merged. Thanks a lot @Dev-Sudarshan and congrats to your sbi contribution 🎉
Resolved conflicts integrating GPU support (PR #1715) into the refactored LC2ST code: - Added device parameter to LC2ST.__init__ with GPU detection - Integrated NeuralNetBinaryClassifier for GPU-accelerated training - Added skorch ValidSplit and EarlyStopping configuration - Fixed target dtype for skorch (float32) vs sklearn (int64) - Updated tests to use refactored cal_data fixture 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
This PR adds optional GPU support to L-C2ST by introducing a PyTorch-based
MLP classifier implemented via skorch. This addresses issue #1160 .
Changes: