xnn.common.config.schema.TrainerConfig#

class xnn.common.config.schema.TrainerConfig(loggers=<factory>, log_every_n_epochs=1, log_every_n_steps=0, step_average='batch', metrics=<factory>, monitor='val/loss', mode='min', val_every_n_epochs=1, save_every_n_epochs=0, early_stopping_patience=0, early_stopping_min_delta=0.0, early_stopping_threshold=None, progress_bar=False, cuda_graph=False)[source]#

Bases: object

Logging, error metrics, checkpointing and stopping of a training run.

Variables:
  • loggers (list of str) – Where the metrics go: any of console, csv (metrics.csv in output_dir) and tensorboard (output_dir/tensorboard). Defaults to ["console"].

  • log_every_n_epochs (int) – Log the epoch metrics every n epochs (and after the last). Defaults to 1.

  • log_every_n_steps (int) – When > 0, also log the training values every n optimizer steps. Defaults to 0.

  • step_average (str) – What a step value is: "batch" (that step’s batch) or "running" (the epoch so far). Defaults to "batch".

  • metrics (list of str) – Error metrics computed besides the loss terms, from mae and rmse, for every labelled property (energy per atom, forces, stress, dipole, polarizability, charges). Defaults to both.

  • monitor (str) – The logged value that picks best.pt, drives the plateau scheduler and early stopping, e.g. val/forces_mae. A val/ monitor falls back to train/ without a validation set. Defaults to "val/loss".

  • mode (str) – "min" or "max": whether a lower or a higher monitored value is better. Defaults to "min".

  • val_every_n_epochs (int) – Validate every n epochs (and after the last). Defaults to 1.

  • save_every_n_epochs (int) – When > 0, also keep epoch_<n>.pt every n epochs. Defaults to 0.

  • early_stopping_patience (int) – Stop after this many validations without improvement of the monitored value; 0 (default) never stops early.

  • early_stopping_min_delta (float) – The least change that counts as an improvement. Defaults to 0.0.

  • early_stopping_threshold (float, optional) – Stop as soon as the monitored value is better than this. Defaults to None.

  • progress_bar (bool) – Show a progress bar over each epoch’s batches. Defaults to False.

  • cuda_graph (bool) – Replay every training step as one CUDA graph (DimeNet, DimeNet++, GemNet, PhysNet and SpookyNet on one GPU, single head): faster where a step is bound by kernel launches, as with small molecules. Batches are padded to fixed counts and the last, smaller batch of an epoch is dropped. Where the model’s fast kernels take the batches (use_fast), the first steps time ordinary steps on them against captured ones and training goes on with the faster. Defaults to False.

Parameters:
  • loggers (list[str])

  • log_every_n_epochs (int)

  • log_every_n_steps (int)

  • step_average (str)

  • metrics (list[str])

  • monitor (str)

  • mode (str)

  • val_every_n_epochs (int)

  • save_every_n_epochs (int)

  • early_stopping_patience (int)

  • early_stopping_min_delta (float)

  • early_stopping_threshold (float | None)

  • progress_bar (bool)

  • cuda_graph (bool)

validate()[source]#

Normalize the list options and reject unknown names.

Return type:

None