-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to save checkpoints within lightning_logs? #1207
Comments
Hi, this is how I do it: tt_logger = TestTubeLogger(save_dir=str(log_dir / "tt_logs"), name=run_name)
checkpoint_dir = (
Path(tt_logger.save_dir)
/ tt_logger.experiment.name
/ f"version_{tt_logger.experiment.version}"
/ "checkpoints"
)
filepath = checkpoint_dir / "{epoch}-{val_loss:.4f}"
checkpoint_cb = ModelCheckpoint(filepath=str(filepath))
trainer = pl.Trainer(
logger=tt_logger,
checkpoint_callback=checkpoint_cb,
...
) |
Hi, the TensorBoard version inspired by @chris-clem snippet. Any idea how to get rid of the "HACK"?
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@Borda Could we re-open this?
seem to me a bit unintuitive, because it decouples the checkpoints from stored configs and logs. It would be really handy to have the structure @polars05 proposed as default. Maybe one option could be a new argument such that new defaults are:
or similar ? |
@Borda Thank you It seems @awaelchli is working to standardize a self.experiment_dir across logger base class! #14188 Another auto-closed issue which seems to access the exact log dir (including version_id): |
My bad, there seems to already be a way to do this: For reference, this is how to set this in a .yaml for LightningCLI directory: my/output/dir
trainer:
#default_root_dir:
callbacks:
- class_path: ModelCheckpoint # short-hand notation
init_args:
#dirpath: checkpoints
logger:
class_path: pytorch_lightning.loggers.TensorBoardLogger
init_args:
save_dir: ${directory}
name: some_experiment_name
That is:
I suggest that this should be clearly specified in the documentation for @Borda We can close this issue now, and I'll report it in #14188. Sorry for the disturbance |
I'm currently doing checkpointing as follows:
This creates the following folder structure:
How can I get the .pth files for each version to be saved in the respective version folders like so?:
The text was updated successfully, but these errors were encountered: