Skip to content

Commit d62cd78

Browse files
gitttt-1234claude
andcommitted
Update EarlyStoppingConfig default: stop_training_on_plateau=True
Changed the default value of stop_training_on_plateau from False to True to enable early stopping by default for better training behavior. Updates: - sleap_nn/config/trainer_config.py: Updated default to True and fixed documentation - docs/config.md: Updated documentation to reflect new default - tests/config/test_trainer_config.py: Updated test assertions to expect True This ensures early stopping is enabled by default with the improved patience and min_delta values from the previous commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ea2ec8e commit d62cd78

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ trainer_config:
795795

796796
### Early Stopping
797797
- `early_stopping`:
798-
- `stop_training_on_plateau`: (bool) True if early stopping should be enabled. **Default**: `False`
798+
- `stop_training_on_plateau`: (bool) True if early stopping should be enabled. **Default**: `True`
799799
- `min_delta`: (float) Minimum change in the monitored quantity to qualify as an improvement, i.e. an absolute change of less than or equal to min_delta, will count as no improvement. **Default**: `1e-8`
800800
- `patience`: (int) Number of checks with no improvement after which training will be stopped. Under the default configuration, one check happens after every training epoch. **Default**: `10`
801801

sleap_nn/config/trainer_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ class EarlyStoppingConfig:
181181
"""Configuration for early_stopping.
182182
183183
Attributes:
184-
stop_training_on_plateau: (bool) True if early stopping should be enabled. *Default*: `False`.
184+
stop_training_on_plateau: (bool) True if early stopping should be enabled. *Default*: `True`.
185185
min_delta: (float) Minimum change in the monitored quantity to qualify as an improvement, i.e. an absolute change of less than or equal to min_delta, will count as no improvement. *Default*: `1e-8`.
186186
patience: (int) Number of checks with no improvement after which training will be stopped. Under the default configuration, one check happens after every training epoch. *Default*: `10`.
187187
"""
188188

189189
min_delta: float = field(default=1e-8, validator=validators.ge(0))
190190
patience: int = field(default=10, validator=validators.ge(0))
191-
stop_training_on_plateau: bool = False
191+
stop_training_on_plateau: bool = True
192192

193193

194194
@define

tests/config/test_trainer_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ def test_early_stopping_config():
183183
"""
184184
# Check default values
185185
conf = OmegaConf.structured(EarlyStoppingConfig)
186-
assert conf.stop_training_on_plateau is False
186+
assert conf.stop_training_on_plateau is True
187187
assert conf.min_delta == 1e-8
188188
assert conf.patience == 10
189189

190190
# Test customization
191191
custom_conf = OmegaConf.structured(
192-
EarlyStoppingConfig(stop_training_on_plateau=True, patience=5)
192+
EarlyStoppingConfig(stop_training_on_plateau=False, patience=5)
193193
)
194-
assert custom_conf.stop_training_on_plateau is True
194+
assert custom_conf.stop_training_on_plateau is False
195195
assert custom_conf.patience == 5
196196

197197
# Test validation
@@ -217,7 +217,7 @@ def test_trainer_config(caplog):
217217
assert conf_structured.optimizer.lr == 1e-4
218218
assert conf_structured.lr_scheduler is not None
219219
assert conf_structured.lr_scheduler.reduce_lr_on_plateau is not None
220-
assert conf_structured.early_stopping.stop_training_on_plateau is False
220+
assert conf_structured.early_stopping.stop_training_on_plateau is True
221221
assert conf_structured.use_wandb is False
222222
assert conf_structured.ckpt_dir == "."
223223
assert conf_structured.run_name is None

0 commit comments

Comments
 (0)