scvi.external.decipher._trainingplan.DecipherTrainingPlan#
- class scvi.external.decipher._trainingplan.DecipherTrainingPlan(pyro_module, loss_fn=None, optim=None, optim_kwargs=None)[source]#
Bases:
PyroTrainingPlanLightning module task to train the Decipher Pyro module.
- Parameters:
- pyro_module
PyroBaseModuleClass An instance of
PyroBaseModuleClass. This object should have callablemodelandguideattributes or methods.- loss_fn
ELBO|None(default:None) A Pyro loss. Should be a subclass of
ELBO. IfNone, defaults toTrace_ELBO.- optim
PyroOptim|None(default:None) A Pyro optimizer instance, e.g.,
Adam(). IfNone, defaults toAdam()optimizer with a learning rate of1e-3.- optim_kwargs
dict|None(default:None) Keyword arguments for default optimiser
Adam().
- pyro_module
Attributes table#
Methods table#
|
No-op, as Pyro computes the gradients inside the training step. |
Shim optimizer for PyTorch Lightning. |
|
Training epoch end for Pyro training. |
|
Validation epoch end for Pyro training. |
|
Prepare the model for validation by switching to train mode. |
|
|
No-op, as the Pyro optimizer steps inside the training step. |
|
Training step for Pyro training. |
|
Validation step for Pyro training. |
Attributes#
- DecipherTrainingPlan.training#
Methods#
- DecipherTrainingPlan.backward(*args, **kwargs)[source]#
No-op, as Pyro computes the gradients inside the training step.
- DecipherTrainingPlan.configure_optimizers()[source]#
Shim optimizer for PyTorch Lightning.
PyTorch Lightning wants to take steps on an optimizer returned by this function in order to increment the global step count. See PyTorch Lighinting optimizer manual loop.
Here we provide a shim optimizer that we can take steps on at minimal computational cost in order to keep Lightning happy :).
- DecipherTrainingPlan.on_validation_model_train()[source]#
Prepare the model for validation by switching to train mode.