scdynomics.bimodal_pretrain

scdynomics.bimodal_pretrain(config_path: str, data_corpus_path: str, mod1_layer: str = 'X', mod2_layer: str = 'pan_promoter', valid_fraction: float = 0.001, dataloader_worker: int = 10, pretrainer_ckpt: str = None, token_dict_path: str = '../data/gene_dict/token_dict.json.gz', default_root_dir: str = '../logs', seed: int = 42, ndevices: int = 1, accelerator: str = 'cpu') tuple

Pretraining pipeline for bimodal data

Parameters:
config_path: str

The path to the JSON configuration file containing dataloader and trainer hyperparameters.

data_corpus_path: str

The path to the preprocessed data corpus file.

mod1_layer: str (default: "X")

The layer name of modality 1 in the data corpus file.

mod2_layer: str (default: "pan_promoter")

The layer name of modality 2 in the data corpus file.

valid_fraction: float (default: 0.001)

The fraction of the data to be reserved for validation.

dataloader_worker: int (default: 10)

The number of workers to be used for data loading.

pretrainer_ckpt: str (default: None)

The path to an existing pretrainer checkpoint file. If None, the model will be randomly initialized and trained from scratch.

token_dict_path: str (default: "../data/gene_dict/token_dict.json.gz")

The path to the token dictionary file used to map genes to tokens.

default_root_dir: str (default: "../logs")

The default root directory for saving PyTorch Lightning logs and checkpoints.

seed: int (default: 42)

The random seed for reproducibility across runs.

ndevices: int (default: 1)

The number of accelerator devices to be used for training.

accelerator: str (default: "cpu")

The accelerator to be used for training. It can be “auto”, “cuda”, “mps”, or “cpu”.

Returns: tuple
trainer: pytorch_lightning.Trainer

The instantiated and executed pytorch_lightning.Trainer object.

model: Masked_Pretrainer

The trained pretrainer model object.