lightning_trainer module
Full Documentation for hippynn.experiment.lightning_trainer
module.
Click here for a summary page.
Pytorch Lightning training interface.
This module is somewhat experimental. Using pytorch lightning successfully in a distributed context may require understanding and adjusting the various settings related to parallelism, e.g. multiprocessing context, torch ddp backend, and how they interact with your HPC environment.
- Some features of hippynn experiments may not be implemented yet.
The plotmaker is currently not supported.
- class HippynnLightningModule(*args: Any, **kwargs: Any)[source]
Bases:
LightningModule
A pytorch lightning module for running a hippynn experiment.
- classmethod from_experiment_setup(training_modules: TrainingModules, database: Database | None, setup_params: SetupParams, **kwargs)[source]
Create a lightning module using the same arguments as for
hippynn.experiment.setup_and_train()
.- Parameters:
training_modules
database
setup_params
kwargs
- Returns:
lightning_module, database
- classmethod from_train_setup(training_modules: TrainingModules, database: Database | None, controller: Controller, metric_tracker: MetricTracker, callbacks=None, batch_callbacks=None, **kwargs)[source]
Create a lightning module from the same arguments as for
hippynn.experiment.train_model()
.- Parameters:
training_modules
database
controller
metric_tracker
callbacks
batch_callbacks
kwargs
- Returns:
lightning_module, database
- classmethod load_from_checkpoint(checkpoint_path, map_location=None, structure_file=None, hparams_file=None, strict=True, weights_only=False, **kwargs)[source]
- Parameters:
checkpoint_path
map_location
structure_file
hparams_file
strict
weights_only
kwargs
This function uses
torch.load
withweights_only=False
by default, which can run arbitrary code from the loaded file. Only use it with files you trust. You can setweights_only=True
for better security, but it may cause loading of the structure file to fail.- Returns: