- Added sparse matrix support for
RegDiffusionTrainer. Theexp_arrayargument now accepts scipy sparse matrices (e.g.adata.X) directly. Normalization statistics are computed in chunks and each sample is normalized on-the-fly during training, so the full dense matrix is never materialized. This enables training on datasets with 1M+ cells without excessive memory usage. - Updated CLI (
regdiffusioncommand) to handle sparseadata.Xfrom H5AD files, including sparse-safe data validation and log-transform vialog1pon non-zero entries.
- Removed three
(n_gene, n_gene)helper matrices (zeros_nonparam,eye_nonparam,mask_nonparam) fromRegDiffusion, replacing them with inline computations. Saves ~4.8 GB persistent GPU memory for 20K genes with no impact on model accuracy.
- Added
RegDiffusionME, a memory-efficient model variant enabled viamemory_efficient=TrueinRegDiffusionTrainer. Reduces peak GPU memory by ~45% with no impact on accuracy. Uses a custom autograd function for soft thresholding (boolean masks instead of float32 tensors) and sampled sparse loss (avoids materializing full adjacency matrix for L1 regularization). Benchmarked on all 7 BEELINE datasets with identical AUROC/AUPRR/EPR. - Added automatic mixed precision (AMP) support via
use_amp=TrueinRegDiffusionTrainer. Uses bfloat16 for forward pass and loss computation, reducing memory for autograd-saved activations while keeping model parameters in float32. Requires Ampere or newer GPU.
- Fixed
I_minus_A()usingself.traininstead ofself.training, causing dropout to always apply during inference - Fixed missing
selfparameter inGRN.remove_weak_edges() - Fixed
GRN.get_edgelist()incorrectly passingselftoextract_edgelist() - Fixed external logger not being assigned in
RegDiffusionTrainer.__init__() - Fixed
forward()crash whenn_celltype=Noneby adding conditional cell type embedding