scvi.model.base.PyroSviTrainMixin#
- class scvi.model.base.PyroSviTrainMixin[source]#
Mixin class for training Pyro models.
Training using minibatches and using full data (copies data to GPU only once).
Methods table#
|
Train the model. |
Methods#
- PyroSviTrainMixin.train(max_epochs=None, accelerator='auto', device='auto', train_size=None, validation_size=None, shuffle_set_split=True, batch_size=128, early_stopping=False, lr=None, training_plan=None, datasplitter_kwargs=None, plan_config=None, plan_kwargs=None, trainer_config=None, **trainer_kwargs)[source]#
Train the model.
- Parameters:
- max_epochs
int|None(default:None) Number of passes through the dataset. If
None, defaults tonp.min([round((20000 / n_cells) * 400), 400])- accelerator
str(default:'auto') Supports passing different accelerator types
("cpu", "gpu", "tpu", "ipu", "hpu", "mps, "auto")as well as custom accelerator instances.- device
int|str(default:'auto') The device to use. Can be set to a non-negative index (
intorstr) or"auto"for automatic selection based on the chosen accelerator. If set to"auto"andacceleratoris not determined to be"cpu", thendevicewill be set to the first available device.- train_size
float|None(default:None) Size of training set in the range [0.0, 1.0].
- validation_size
float|None(default:None) Size of the test set. If
None, defaults to 1 -train_size. Iftrain_size + validation_size < 1, the remaining cells belong to a test set.- shuffle_set_split
bool(default:True) Whether to shuffle indices before splitting. If
False, the val, train, and test set are split in the sequential order of the data according tovalidation_sizeandtrain_sizepercentages.- batch_size
int(default:128) Minibatch size to use during training. If
None, no minibatching occurs and all data is copied to device (e.g., GPU).- early_stopping
bool(default:False) Perform early stopping. Additional arguments can be passed in
**kwargs. SeeTrainerfor further options.- lr
float|None(default:None) Optimiser learning rate (default optimiser is
ClippedAdam). Specifying optimiser via plan_kwargs overrides this choice of lr.- training_plan
PyroTrainingPlan|None(default:None) Training plan
PyroTrainingPlan.- datasplitter_kwargs
dict|None(default:None) Additional keyword arguments passed into
DataSplitter.- plan_kwargs
Mapping[str,Any] |KwargsConfig|None(default:None) Keyword args for
PyroTrainingPlan. Keyword arguments passed totrain()will overwrite values present inplan_kwargs, when appropriate.- plan_config
Mapping[str,Any] |KwargsConfig|None(default:None) Configuration object or mapping used to build
PyroTrainingPlan. Values inplan_kwargsand explicit arguments take precedence.- trainer_config
Mapping[str,Any] |KwargsConfig|None(default:None) Configuration object or mapping used to build
Trainer. Values intrainer_kwargsand explicit arguments take precedence.- **trainer_kwargs
Other keyword args for
Trainer.
- max_epochs