Trainer#

These configs configure PyTorch Lightning Trainer objects.

See also

lightning

Note

To use an alternative trainer config, use a command like:

workshop train trainer=<TRAINER_NAME> encoder=gvp dataset=cath task=inverse_folding
# or
python proteinworkshop/train.py trainer=<TRAINER_NAME> encoder=gvp dataset=cath task=inverse_folding

where <TRAINER_NAME> is the name of the trainer config.

Default (default)#

# Example usage
python proteinworkshop/train.py ... trainer.max_epochs=1000
_target_: lightning.pytorch.trainer.Trainer

default_root_dir: ${env.paths.output_dir}

min_epochs: 1 # prevents early stopping
max_epochs: 10

accelerator: cpu

# mixed precision for extra speed-up
# precision: 16

# perform a validation loop every N training epochs
check_val_every_n_epoch: 1

# set True to to ensure deterministic results
# makes training slower but gives more reproducibility than just setting seeds
deterministic: False
num_sanity_val_steps: 2

GPU (gpu)#

defaults:
  - default.yaml

accelerator: gpu
devices: 1

CPU (cpu)#

defaults:
  - default.yaml

accelerator: cpu

DDP (ddp)#

defaults:
  - default.yaml

# NOTE: https://github.com/facebookresearch/hydra/issues/2070
# for improved Hydra + Lightning + DDP support is not merged yet
strategy: ddp_find_unused_parameters_true

accelerator: gpu
devices: 4
num_nodes: 1
sync_batchnorm: True

DDP Sim (ddp_sim)#

defaults:
  - default.yaml

# simulate DDP on CPU, useful for debugging
accelerator: cpu
devices: 2
strategy: ddp_spawn

MPS (mps)#

defaults:
  - default.yaml

accelerator: mps
devices: 1