vak.config.trainer.TrainerConfig

class vak.config.trainer.TrainerConfig(accelerator: str = 'cpu', devices: int | list[int] | None = None)[source]

Bases: object

Class that represents trainer sub-table in a toml configuration file.

Used to configure lightning.pytorch.Trainer.

accelerator

Value for the accelerator argument to lightning.pytorch.Trainer. Default is the return value of vak.common.accelerator.get_default().

Type:

str

devices

Number of devices (int) or exact device(s) (list of int) to use.

Type:

int, list of int

Notes

Using the ‘auto’ value for the lightning.pytorch.Trainer parameter accelerator currently breaks functionality for the command-line interface of vak. Please see this issue: https://github.com/vocalpy/vak/issues/691 If you need to use the ‘auto’ mode of lightning.pytorch.Trainer, please use vak directly in a script.

Likewise, setting a value for the lightning.pytorch.Trainer parameter devices that is not either 1 (meaning “use a single GPU”) or a list with a single number (meaning “use this exact GPU”) currently breaks functionality for the command-line interface of vak. Please see this issue: https://github.com/vocalpy/vak/issues/691 If you need to use multiple GPUs, please use vak directly in a script.

__init__(accelerator: str = 'cpu', devices: int | list[int] | None = None) None

Method generated by attrs for class TrainerConfig.

Methods

__init__([accelerator, devices])

Method generated by attrs for class TrainerConfig.

asdict()

Convert this TrainerConfig instance to a dict that can be passed into functions that take a trainer_config argument, like vak.train() and vak.predict().

Attributes

asdict()[source]

Convert this TrainerConfig instance to a dict that can be passed into functions that take a trainer_config argument, like vak.train() and vak.predict().