scvi.dataloaders.TileDBDataModule#
- class scvi.dataloaders.TileDBDataModule(query, *args, batch_column_names=None, batch_labels=None, label_keys=None, unlabeled_category='Unknown', sample_key=None, train_size=1.0, split_seed=None, dataloader_kwargs=None, accelerator='auto', device='auto', model_name='SCVI', categorical_covariate_keys=None, continuous_covariate_keys=None, **kwargs)[source]#
Bases:
LightningDataModulePyTorch Lightning DataModule for training scVI models from SOMA data
Wraps a tiledbsoma_ml.ExperimentDataset to stream the results of a SOMA ExperimentAxisQuery, exposing a DataLoader to generate tensors ready for scVI model training. Also handles deriving the scVI batch label as a tuple of obs columns.
Attributes table#
Seed for data split. |
|
Fraction of data to use for training. |
|
String assigned to unlabeled cells. |
|
Fraction of data to use for validation. |
Methods table#
Dataloader for inference with on_before_batch_transfer applied. |
|
|
Convert a tiledbsoma batch to the dictionary scvi-tools expects. |
|
Called at the beginning of fit (train + validate), validate, test, or predict. |
Create the train data loader. |
|
Create the validation data loader. |
Attributes#
Methods#
- TileDBDataModule.inference_dataloader()[source]#
Dataloader for inference with on_before_batch_transfer applied.
- TileDBDataModule.on_before_batch_transfer(batch, dataloader_idx)[source]#
Convert a tiledbsoma batch to the dictionary scvi-tools expects.
- TileDBDataModule.setup(stage=None)[source]#
Called at the beginning of fit (train + validate), validate, test, or predict. This is a good hook when you need to build models dynamically or adjust something about them. This hook is called on every process when using DDP.
- Parameters:
stage (
str|None(default:None)) – either'fit','validate','test', or'predict'- Return type:
Example:
class LitModel(...): def __init__(self): self.l1 = None def prepare_data(self): download_data() tokenize() # don't do this self.something = else def setup(self, stage): data = load_data(...) self.l1 = nn.Linear(28, data.num_classes)