Add StopPredictionCallback to lightning callbacks#756
Merged
jdeschamps merged 8 commits intomainfrom Feb 10, 2026
Merged
Conversation
Member
Author
|
I tried to make a test tests/lightning/callbacks/test_stop_prediction_callback.py but I am not as experienced with this.. if you think it is unnecessary I can remove it. |
jdeschamps
requested changes
Feb 9, 2026
Member
jdeschamps
left a comment
There was a problem hiding this comment.
All good, but indeed most tests need to go away. I made commit suggestions, you can just commit them if you agree.
Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
jdeschamps
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Note
tldr: Added
StopPredictionCallbackto CAREamics lightning callbacks for prediction stopping.Overview - what changed?
This PR moves the prediction stopping functionality from careamics-napari to the main CAREamics library. The callback now accepts a generic
Callable[[], bool]condition instead of UI-specific state objects.Changes Made
New features or files
StopPredictionCallbackclass insrc/careamics/lightning/callbacks/stop_prediction_callback.pyPredictionStoppedExceptionexception for signaling prediction interruptiontests/lightning/callbacks/test_stop_prediction_callback.pyModified features or files
src/careamics/lightning/callbacks/__init__.py- added new exportssrc/careamics/lightning/__init__.py- exposed the callbackHow has this been tested?
from careamics.lightning.callbacks import StopPredictionCallback, PredictionStoppedExceptionRelated Issues
Please ensure your PR meets the following requirements: