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 ofPyroBaseModuleClass. This object should have callable model and guide attributes or methods.loss_fn (
ELBO|None(default:None)) – A Pyro loss. Should be a subclass ofELBO. If None, defaults toTrace_ELBO.optim (
PyroOptim|None(default:None)) – A Pyro optimizer instance, e.g.,Adam(). If None, defaults toAdam()optimizer with a learning rate of 1e-3.optim_kwargs (
dict|None(default:None)) – Keyword arguments for default optimiserAdam().
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: bool#
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.