nshtrainer 1.3.2__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:
@@ -374,6 +374,10 @@ class TrainerConfig(C.Config):
374
374
  """Tags for the run."""
375
375
  notes: list[str] = []
376
376
  """Human readable notes for the run."""
377
+ meta: dict[str, Any] = {}
378
+ """Metadata information for the run. This is a dictionary that can be used to store any additional information
379
+ about the run. It is not used by nshtrainer, but can be useful for logging or tracking purposes.
380
+ """
377
381
 
378
382
  @property
379
383
  def full_name(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: nshtrainer
3
- Version: 1.3.2
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
@@ -135,7 +135,7 @@ nshtrainer/profiler/advanced.py,sha256=XrM3FX0ThCv5UwUrrH0l4Ow4LGAtpiBww2N8QAU5N
135
135
  nshtrainer/profiler/pytorch.py,sha256=8K37XvPnCApUpIK8tA2zNMFIaIiTLSoxKQoiyCPBm1Q,2757
136
136
  nshtrainer/profiler/simple.py,sha256=PimjqcU-JuS-8C0ZGHAdwCxgNLij4x0FH6WXsjBQzZs,1005
137
137
  nshtrainer/trainer/__init__.py,sha256=jRaHdaFK8wxNrN1bleT9cf29iZahL_-XkWo5TWz2CmA,550
138
- nshtrainer/trainer/_config.py,sha256=Lt9tuzxgVzVnyEFz61xbaPudfsXbKYUphOg-qMDHO8g,33203
138
+ nshtrainer/trainer/_config.py,sha256=SohR7uxANnP3xrrcW_mAjk6TuDamsW5Qdk3dlnPinDw,33457
139
139
  nshtrainer/trainer/_distributed_prediction_result.py,sha256=bQw8Z6PT694UUf-zQPkech6CxyUSy8bAIexfSfPej0U,2507
140
140
  nshtrainer/trainer/_log_hparams.py,sha256=XH2lZ4U_3AZBhOt91ocsEhdL_NRz35oWvqLCUFDohUs,2389
141
141
  nshtrainer/trainer/_runtime_callback.py,sha256=6F2Gq27Q8OFfN3RtdNC6QRA8ac0LC1hh4DUE3V5WgbI,4217
@@ -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.2.dist-info/METADATA,sha256=XQdG9IP0N83areh70D1kM_rneikv2JQnO2VS34_MXRM,960
164
- nshtrainer-1.3.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
165
- nshtrainer-1.3.2.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,,