nshtrainer 0.10.6__py3-none-any.whl → 0.10.7__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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nshtrainer
3
- Version: 0.10.6
3
+ Version: 0.10.7
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
@@ -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.7.dist-info/METADATA,sha256=IQ6IEecsAvygnoV5P6_mkG9RjRGnb_cFuOf2Ic2HLIY,695
83
+ nshtrainer-0.10.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
84
+ nshtrainer-0.10.7.dist-info/RECORD,,