nshtrainer 1.3.3__py3-none-any.whl → 1.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,6 +43,13 @@ class EarlyStoppingCallbackConfig(CallbackConfigBase):
43
43
  the training will be stopped.
44
44
  """
45
45
 
46
+ skip_first_n_epochs: int = 0
47
+ """
48
+ Number of initial epochs to skip before starting to monitor for early stopping.
49
+ This helps avoid false early stopping when the model might temporarily perform worse
50
+ during early training phases.
51
+ """
52
+
46
53
  strict: bool = True
47
54
  """
48
55
  Whether to enforce that the monitored quantity must improve by at least `min_delta`
@@ -94,6 +101,16 @@ class EarlyStoppingCallback(_EarlyStopping):
94
101
  if getattr(trainer, "fast_dev_run", False):
95
102
  return
96
103
 
104
+ # Skip early stopping check for the first n epochs
105
+ if trainer.current_epoch < self.config.skip_first_n_epochs:
106
+ if self.verbose and trainer.current_epoch == 0:
107
+ self._log_info(
108
+ trainer,
109
+ f"Early stopping checks are disabled for the first {self.config.skip_first_n_epochs} epochs",
110
+ self.log_rank_zero_only,
111
+ )
112
+ return
113
+
97
114
  should_stop, reason = False, None
98
115
 
99
116
  if not should_stop:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: nshtrainer
3
- Version: 1.3.3
3
+ Version: 1.3.4
4
4
  Summary:
5
5
  Author: Nima Shoghi
6
6
  Author-email: nimashoghi@gmail.com
@@ -17,7 +17,7 @@ nshtrainer/callbacks/checkpoint/on_exception_checkpoint.py,sha256=nljzETqkHwA-4g
17
17
  nshtrainer/callbacks/debug_flag.py,sha256=96fuP0C7C6dSs1GiMeUYzzs0X3Q4Pjt9JVWg3b75fU4,1748
18
18
  nshtrainer/callbacks/directory_setup.py,sha256=Ln6f0tCgoBscHeigIAWtCCoAmuWB-kPyaf7SylU7MYo,2773
19
19
  nshtrainer/callbacks/distributed_prediction_writer.py,sha256=PvxV9E9lHT-NQ-h1ld7WugajqiFyFXECsreUt3e7pxk,5440
20
- nshtrainer/callbacks/early_stopping.py,sha256=rC_qYKCQWjRQJFo0ky46uG0aDJdYP8vsSlKunk0bUVI,4765
20
+ nshtrainer/callbacks/early_stopping.py,sha256=LTwOME4-_Zld08UjOeeoNxPOg-hCN7o9MAUWVdzGDdk,5467
21
21
  nshtrainer/callbacks/ema.py,sha256=dBFiUXG0xmyCw8-ayuSzJMKqSbepl6Ii5VIbhFlT5ug,12255
22
22
  nshtrainer/callbacks/finite_checks.py,sha256=3lZ3kEIjmYQfqTF0DcrgZ9_98ZLQhQj8usH7SgWst3o,2185
23
23
  nshtrainer/callbacks/gradient_skipping.py,sha256=8g7oC7PF0LTAEzwiNoaS5tWOnkjk_EB0QG3JdHkQ8ek,3523
@@ -160,6 +160,6 @@ nshtrainer/util/seed.py,sha256=diMV8iwBKN7Xxt5pELmui-gyqyT80_CZzomrWhNss0k,316
160
160
  nshtrainer/util/slurm.py,sha256=HflkP5iI_r4UHMyPjw9R4dD5AHsJUpcfJw5PLvGYBRM,1603
161
161
  nshtrainer/util/typed.py,sha256=Xt5fUU6zwLKSTLUdenovnKK0N8qUq89Kddz2_XeykVQ,164
162
162
  nshtrainer/util/typing_utils.py,sha256=MjY-CUX9R5Tzat-BlFnQjwl1PQ_W2yZQoXhkYHlJ_VA,442
163
- nshtrainer-1.3.3.dist-info/METADATA,sha256=K_xd3BrF1Yz7gGbNQgywkjysCFuwXi3GCBoQ5EaFVKY,960
164
- nshtrainer-1.3.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
165
- nshtrainer-1.3.3.dist-info/RECORD,,
163
+ nshtrainer-1.3.4.dist-info/METADATA,sha256=Dm6wgfQh8ZC42IeftejuUZ-KZ2YBWBjnpHa_pYNi7Kc,960
164
+ nshtrainer-1.3.4.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
165
+ nshtrainer-1.3.4.dist-info/RECORD,,