nshtrainer 0.10.6__py3-none-any.whl → 0.10.8__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,10 +43,6 @@ class LatestEpochCheckpoint(Checkpoint):
43
43
  self.config = config
44
44
  self.dirpath = dirpath
45
45
 
46
- # Also, we hold a reference to the last checkpoint path
47
- # to be able to remove it when a new checkpoint is saved.
48
- self._last_ckpt_path: Path | None = None
49
-
50
46
  def _ckpt_path(self, trainer: Trainer):
51
47
  return self.dirpath / self.config.filename.format(
52
48
  epoch=trainer.current_epoch, step=trainer.global_step
@@ -54,20 +50,17 @@ class LatestEpochCheckpoint(Checkpoint):
54
50
 
55
51
  @override
56
52
  def on_train_epoch_end(self, trainer: Trainer, pl_module: LightningModule):
57
- # Remove the last checkpoint if it exists
58
- if self._last_ckpt_path is not None:
59
- trainer.strategy.remove_checkpoint(self._last_ckpt_path)
60
-
61
53
  # Save the new checkpoint
62
54
  filepath = self._ckpt_path(trainer)
63
55
  trainer.save_checkpoint(filepath, self.config.save_weights_only)
64
- self._last_ckpt_path = filepath
65
56
 
66
57
  # Create the latest symlink
67
- if (symlink_filename := self.config.latest_symlink_filename) is not None:
58
+ if (
59
+ trainer.is_global_zero
60
+ and (symlink_filename := self.config.latest_symlink_filename) is not None
61
+ ):
68
62
  symlink_path = self.dirpath / symlink_filename
69
- if symlink_path.exists():
70
- symlink_path.unlink()
63
+ symlink_path.unlink(missing_ok=True)
71
64
  symlink_path.symlink_to(filepath.name)
72
65
  log.info(f"Created latest symlink: {symlink_path}")
73
66
 
@@ -286,6 +286,10 @@ class WandbLoggerConfig(CallbackConfigBase, BaseLoggerConfig):
286
286
  offline: bool = False
287
287
  """Whether to run WandB in offline mode."""
288
288
 
289
+ def offline_(self):
290
+ self.offline = True
291
+ return self
292
+
289
293
  @override
290
294
  def create_logger(self, root_config):
291
295
  if not self.enabled:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nshtrainer
3
- Version: 0.10.6
3
+ Version: 0.10.8
4
4
  Summary:
5
5
  Author: Nima Shoghi
6
6
  Author-email: nimashoghi@gmail.com
@@ -14,7 +14,7 @@ nshtrainer/callbacks/ema.py,sha256=8-WHmKFP3VfnzMviJaIFmVD9xHPqIPmq9NRF5xdu3c8,1
14
14
  nshtrainer/callbacks/finite_checks.py,sha256=AO5fa51uANAjAkeJfTquOjK6W_4RSU5Kky3f5jmAPlQ,2084
15
15
  nshtrainer/callbacks/gradient_skipping.py,sha256=fSJpjgHbztFKz7w3qFuCHZpmbEt9BCLAy-sU0B4xJQI,3474
16
16
  nshtrainer/callbacks/interval.py,sha256=smz5Zl8cN6X6yHKVsMRS2e3SEkzRCP3LvwE1ONvLfaw,8080
17
- nshtrainer/callbacks/latest_epoch_checkpoint.py,sha256=UnwgGIc2reD7cTnUeIlDHo1LeAkgLEZFNvy2NGvUfRQ,2838
17
+ nshtrainer/callbacks/latest_epoch_checkpoint.py,sha256=zCRAUsqW-2PaoIwVKlXOqdh2uF_B_YUUTmQO1wSomR8,2489
18
18
  nshtrainer/callbacks/log_epoch.py,sha256=fTa_K_Y8A7g09630cG4YkDE6AzSMPkjb9bpPm4gtqos,1120
19
19
  nshtrainer/callbacks/model_checkpoint.py,sha256=N0raLsHlCVSbO3QU5eNFUXUDqxxW3C73oQwceMnFE_k,5955
20
20
  nshtrainer/callbacks/norm_logging.py,sha256=EWyrfkp8iHjQi9iAAXHxb0xStw2RwkdpKG2_gLarQRA,6281
@@ -52,7 +52,7 @@ nshtrainer/metrics/_config.py,sha256=hWWS4IXENRyH3RmJ7z1Wx1n3Lt1sNMlGOrcU6PW15o0
52
52
  nshtrainer/model/__init__.py,sha256=TbexTxiE20WHYg5q3L88Hysk4LlHeKk_isv33aSBREA,1918
53
53
  nshtrainer/model/_environment.py,sha256=JCFxxwMhkviiMDkqIXJmiuepqiSYIlcoSQM7Y2H2KX4,23036
54
54
  nshtrainer/model/base.py,sha256=Bmw-t70TydDbE9P0ee-lTibGoUhrCx5Qke-upa7FGVM,17512
55
- nshtrainer/model/config.py,sha256=6pAqDUk1eBloR3vZmtsWVdMrKeT2V3UvOn5UZ7YhZ_Q,53283
55
+ nshtrainer/model/config.py,sha256=FRjn2pVbCzitBeIFcKXXPQ0TCmqvAwSylAvfedf1NHg,53356
56
56
  nshtrainer/model/modules/callback.py,sha256=JF59U9-CjJsAIspEhTJbVaGN0wGctZG7UquE3IS7R8A,6408
57
57
  nshtrainer/model/modules/debug.py,sha256=DTVty8cKnzj1GCULRyGx_sWTTsq9NLi30dzqjRTnuCU,1127
58
58
  nshtrainer/model/modules/distributed.py,sha256=ABpR9d-3uBS_fivfy_WYW-dExW6vp5BPaoPQnOudHng,1725
@@ -79,6 +79,6 @@ nshtrainer/util/seed.py,sha256=HEXgVs-wldByahOysKwq7506OHxdYTEgmP-tDQVAEkQ,287
79
79
  nshtrainer/util/slurm.py,sha256=rofIU26z3SdL79SF45tNez6juou1cyDLz07oXEZb9Hg,1566
80
80
  nshtrainer/util/typed.py,sha256=NGuDkDzFlc1fAoaXjOFZVbmj0mRFjsQi1E_hPa7Bn5U,128
81
81
  nshtrainer/util/typing_utils.py,sha256=8ptjSSLZxlmy4FY6lzzkoGoF5fGNClo8-B_c0XHQaNU,385
82
- nshtrainer-0.10.6.dist-info/METADATA,sha256=YXr1jz_lfmXzwsNBxyYtSh6CbqAJ_wcGdAzkmZoCjH4,695
83
- nshtrainer-0.10.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
84
- nshtrainer-0.10.6.dist-info/RECORD,,
82
+ nshtrainer-0.10.8.dist-info/METADATA,sha256=ui7cY4CqHhyFwX9FvA-1coEPJolmr3WFgqxBRrl8F3M,695
83
+ nshtrainer-0.10.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
84
+ nshtrainer-0.10.8.dist-info/RECORD,,