[Tune] use epoch for ptl checkpoint dir name (#14392)

* use epoch for dir name

* use formatted string
This commit is contained in:
Amog Kamsetty 2021-03-01 20:14:35 -08:00 committed by GitHub
parent dbaa28f81e
commit ca11b189b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,7 +217,8 @@ class _TuneCheckpointCallback(TuneCallback):
def _handle(self, trainer: Trainer, pl_module: LightningModule):
if trainer.running_sanity_check:
return
with tune.checkpoint_dir(step=trainer.global_step) as checkpoint_dir:
step = f"epoch={trainer.current_epoch}-step={trainer.global_step}"
with tune.checkpoint_dir(step=step) as checkpoint_dir:
trainer.save_checkpoint(
os.path.join(checkpoint_dir, self._filename))