refine(repro): enable deterministic algorithms - #1307
Conversation
- seed_all now calls torch.use_deterministic_algorithms(True, warn_only=True) after the cuDNN flags, so every op with a deterministic kernel uses it and the rest warn at execution time instead of raising - guard the call with try/except RuntimeError, logging via get_logger so a failure to enable determinism degrades to a warning rather than propagating out of seed_all - import get_logger in reproducibility - test_train_convergence_segmentation: raise epochs 5 -> 6 and update the docstring epoch references, widening the convergence margin above GPU run-to-run noise --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR targets improved experiment reproducibility by enabling PyTorch’s deterministic algorithms mode (best-effort, warning on unsupported ops) and adjusts the synthetic segmentation training convergence benchmark to run for one additional epoch to stabilize results.
Changes:
- Update
seed_all()to calltorch.use_deterministic_algorithms(True, warn_only=True)and warn (instead of raising) if determinism cannot be enabled. - Update the synthetic segmentation convergence benchmark to train for 6 epochs (and update the corresponding docstring assertions).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/rfdetr/utilities/reproducibility.py |
Enables PyTorch deterministic algorithms mode with guarded warning behavior; updates reproducibility-related documentation/comments. |
tests/benchmarks/test_training_synthetic.py |
Extends the segmentation convergence benchmark from 5 to 6 epochs and updates the test docstring accordingly. |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (60%) is below the target coverage (95%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #1307 +/- ##
=======================================
- Coverage 84% 84% -0%
=======================================
Files 110 110
Lines 13623 13628 +5
=======================================
+ Hits 11454 11457 +3
- Misses 2169 2171 +2 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Reformatted multi-line comment in `seed_all` to improve clarity and adhere to line length conventions.
- seed_all now calls torch.use_deterministic_algorithms(True, warn_only=True) after the cuDNN flags, so every op with a deterministic kernel uses it and the rest warn at execution time instead of raising - guard the call with try/except RuntimeError, logging via get_logger so a failure to enable determinism degrades to a warning rather than propagating out of seed_all - import get_logger in reproducibility - test_train_convergence_segmentation: raise epochs 5 -> 6 and update the docstring epoch references, widening the convergence margin above GPU run-to-run noise --------- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This pull request improves reproducibility and updates a synthetic training benchmark test. The main changes include making PyTorch's deterministic algorithms setting more robust and updating the segmentation convergence test to run for an additional epoch.
Reproducibility improvements:
seed_allfunction to usetorch.use_deterministic_algorithmswithwarn_only=True, ensuring deterministic operations where possible and logging a warning if full determinism can't be enabled instead of raising an error. [1] [2]Benchmark test updates:
test_train_convergence_segmentationto check results after 6 epochs instead of 5, and to run for 6 epochs, improving test reliability. [1] [2]