Core Models & Data

Attention Map

Base Module

class sdofmv2.core.basemodule.BaseModule(*args: Any, **kwargs: Any)[source]

Bases: LightningModule

A foundational PyTorch Lightning module for standardized training.

This base class handles the boilerplate configuration for optimizers and learning rate schedulers. Other models in the pipeline should inherit from this class and implement their specific training_step and validation_step logic.

Parameters:
  • optimizer_dict (dict) – Configuration dictionary for the optimizer. Expected keys include “use” (e.g., “adamw”, “sgd”, “adam”), “learning_rate”, and “weight_decay”.

  • scheduler_dict (dict) – Configuration dictionary for the learning rate scheduler. Expected keys include “use” (e.g., “cosine”, “cosine_warmup”, “plateau”, “exp”), “monitor” (metric to track), and any scheduler-specific hyperparameters.

  • hyperparam_ignore (list[str], optional) – List of parameter names to exclude from Lightning’s automatic hyperparameter saving. Defaults to [].

  • *args – Variable length argument list passed to pl.LightningModule.

  • **kwargs – Arbitrary keyword arguments passed to pl.LightningModule.

Methods

configure_optimizers()

Configure optimizers and learning rate schedulers.

training_step(batch, batch_idx)

Perform a single training step.

validation_step(batch, batch_idx)

Perform a single validation step.

configure_optimizers()[source]

Configure optimizers and learning rate schedulers.

Returns:

Either a single optimizer or a dict

containing optimizer and lr_scheduler configuration.

Return type:

Union[torch.optim.Optimizer, Dict]

training_step(batch, batch_idx)[source]

Perform a single training step.

Parameters:
  • batch – The training batch data.

  • batch_idx – The index of the current batch.

Raises:

NotImplementedError – Subclasses must implement this method.

validation_step(batch, batch_idx)[source]

Perform a single validation step.

Parameters:
  • batch – The validation batch data.

  • batch_idx – The index of the current batch.

Raises:

NotImplementedError – Subclasses must implement this method.

Data Module

Losses

Masked Autoencoder (MAE)

MAE Module

Principal Component Analysis