feat: add early stopping functionality to Maestro models and examples #205
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
This pull request introduces early stopping functionality to the Multimodal Maestro framework, enabling more efficient training by halting when a monitored metric (e.g., validation loss) stops improving. The changes include updates to model configurations, the addition of an
EarlyStoppingCallback
, and examples demonstrating how to use this feature.Early stopping functionality:
Callback addition:
EarlyStoppingCallback
class inmaestro/trainer/common/callbacks.py
to integrate early stopping into PyTorch Lightning trainers. This monitors a specified metric and stops training when improvements cease. [1] [2]Configuration updates:
early_stopping
,early_stopping_patience
,early_stopping_threshold
,early_stopping_monitor
) to the configurations forFlorence2Configuration
,PaliGemma2Configuration
, andQwen25VLConfiguration
. These enable fine-tuning of early stopping behavior. [1] [2] [3] [4] [5] [6]Training logic:
train
methods for Florence-2, PaliGemma-2, and Qwen2.5-VL models to include theEarlyStoppingCallback
when early stopping is enabled in the configuration. [1] [2] [3]Related issue: #198
Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
cookbooks/maestro_early_stopping_example.py
) with examples of enabling early stopping for Florence-2, PaliGemma-2, and Qwen2.5-VL models.Docs
cookbooks/maestro_early_stopping.ipynb
) that demonstrates how to use early stopping with the Florence-2 model. It includes setup, training, and visualization of training metrics.