Shortcuts

SaveConfigCallback

class lightning.pytorch.cli.SaveConfigCallback(parser, config, config_filename='config.yaml', overwrite=False, multifile=False)[source]

Bases: Callback

Saves a LightningCLI config to the log_dir when training starts.

Parameters
  • parser (LightningArgumentParser) – The parser object used to parse the configuration.

  • config (Namespace) – The parsed configuration that will be saved.

  • config_filename (str) – Filename for the config file.

  • overwrite (bool) – Whether to overwrite an existing config file.

  • multifile (bool) – When input is multiple config files, saved config preserves this structure.

Raises

RuntimeError – If the config file already exists in the directory to avoid overwriting a previous run

setup(trainer, pl_module, stage)[source]

Called when fit, validate, test, predict, or tune begins.

Return type

None