scvi._settings.ScviConfig#

class scvi._settings.ScviConfig(verbosity=20, progress_bar_style='tqdm', batch_size=128, seed=0, logging_dir='./scvi_log/', dl_num_workers=0, dl_pin_memory_gpu_training=False, jax_preallocate_gpu_memory=False)[source]#

Config manager for scvi-tools.

Examples

To set the seed

>>> scvi.settings.seed = 1

To set the batch size for functions like SCVI.get_latent_representation

>>> scvi.settings.batch_size = 1024

To set the progress bar style, choose one of “rich”, “tqdm”

>>> scvi.settings.progress_bar_style = "rich"

To set the verbosity

>>> import logging
>>> scvi.settings.verbosity = logging.INFO

To set pin memory for GPU training

>>> scvi.settings.dl_pin_memory_gpu_training = True

To set the number of threads PyTorch will use

>>> scvi.settings.num_threads = 2

To prevent Jax from preallocating GPU memory on start (default)

>>> scvi.settings.jax_preallocate_gpu_memory = False

Attributes table#

batch_size

Minibatch size for loading data into the model.

dl_num_workers

Number of workers for PyTorch data loaders (Default is 0).

dl_pin_memory_gpu_training

Set pin_memory in data loaders when using a GPU for training.

jax_preallocate_gpu_memory

Jax GPU memory allocation settings.

logging_dir

Directory for training logs (default './scvi_log/').

num_threads

Number of threads PyTorch will use.

progress_bar_style

Library to use for progress bar.

seed

Random seed for torch and numpy.

verbosity

Verbosity level (default logging.INFO).

Methods table#

reset_logging_handler()

Resets "scvi" log handler to a basic RichHandler().

Attributes#

batch_size#

ScviConfig.batch_size#

Minibatch size for loading data into the model.

This is only used after a model is trained. Trainers have specific batch_size parameters.

Return type

int

dl_num_workers#

ScviConfig.dl_num_workers#

Number of workers for PyTorch data loaders (Default is 0).

Return type

int

dl_pin_memory_gpu_training#

ScviConfig.dl_pin_memory_gpu_training#

Set pin_memory in data loaders when using a GPU for training.

Return type

int

jax_preallocate_gpu_memory#

ScviConfig.jax_preallocate_gpu_memory#

Jax GPU memory allocation settings.

If False, Jax will ony preallocate GPU memory it needs. If float in (0, 1), Jax will preallocate GPU memory to that fraction of the GPU memory.

logging_dir#

ScviConfig.logging_dir#

Directory for training logs (default ‘./scvi_log/’).

Return type

Path

num_threads#

ScviConfig.num_threads#

Number of threads PyTorch will use.

Return type

None

progress_bar_style#

ScviConfig.progress_bar_style#

Library to use for progress bar.

Return type

str

seed#

ScviConfig.seed#

Random seed for torch and numpy.

Return type

int

verbosity#

ScviConfig.verbosity#

Verbosity level (default logging.INFO).

Return type

int

Methods#

reset_logging_handler#

ScviConfig.reset_logging_handler()[source]#

Resets “scvi” log handler to a basic RichHandler().

This is useful if piping outputs to a file.