torchcell.trainers.int_dcell.RegressionTask
- class RegressionTask(model: Module, cell_graph: HeteroData, optimizer_config: dict[str, Any], lr_scheduler_config: dict[str, Any], batch_size: int | None = None, clip_grad_norm: bool = False, clip_grad_norm_max_norm: float = 0.1, plot_sample_ceiling: int = 1000, plot_every_n_epochs: int = 10, loss_func: Module | None = None, grad_accumulation_schedule: dict[int, int] | None = None, device: str = 'cuda', forward_transform: Module | None = None, inverse_transform: Module | None = None)[source]
Bases:
LightningModuleLightning module training a DCell model to regress gene interactions.
- forward(batch: HeteroData) tuple[Tensor, dict[str, Any]][source]
Run a forward pass through the model on the given batch.
- training_step(batch: HeteroData, batch_idx: int) Tensor[source]
Run a manual-optimization training step with gradient accumulation.
- validation_step(batch: HeteroData, batch_idx: int) Tensor[source]
Run the shared step for the validation stage and return the loss.
- test_step(batch: HeteroData, batch_idx: int) Tensor[source]
Run the shared step for the test stage and return the loss.
- on_train_epoch_end() None[source]
Log and reset training metrics and plot training samples periodically.
- on_train_epoch_start() None[source]
Clear training sample buffers on epochs where samples are collected.
- on_validation_epoch_start() None[source]
Clear validation sample buffers on epochs where samples are collected.