Skip to content

fix: update bug of installation with custom dataloder #3331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Module classes in the external API with respective generative and inference proc
external.methylvi.METHYLANVAE
external.decipher.DecipherPyroModule
external.resolvi.RESOLVAE
external.totalanvi.TOTALANVAE
external.sysvi.SysVAE

```
Expand Down
1 change: 1 addition & 0 deletions docs/api/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import scvi
external.METHYLVI
external.METHYLANVI
external.Decipher
external.TOTALANVI
external.RESOLVI
external.SysVI
```
Expand Down
14 changes: 7 additions & 7 deletions src/scvi/dataloaders/_custom_dataloders.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
if TYPE_CHECKING:
from typing import Any

import lamindb as ln
import pandas as pd
import tiledbsoma as soma


@dependencies("lamindb")
class MappedCollectionDataModule(LightningDataModule):
import lamindb as ln

@dependencies("lamindb")
def __init__(
self,
collection: ln.Collection,
Expand Down Expand Up @@ -353,18 +353,15 @@ def __len__(self):
return len(self.dataloader)


@dependencies("tiledbsoma")
@dependencies("tiledbsoma_ml")
class TileDBDataModule(LightningDataModule):
import tiledbsoma as soma

"""PyTorch 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.
"""

@dependencies("tiledbsoma")
def __init__(
self,
query: soma.ExperimentAxisQuery,
Expand Down Expand Up @@ -503,6 +500,7 @@ def __init__(
accelerator=accelerator, devices=device, return_device="torch"
)

@dependencies("tiledbsoma_ml")
def setup(self, stage: str | None = None) -> None:
# Instantiate the ExperimentDataset with the provided args and kwargs.
from tiledbsoma_ml import ExperimentDataset
Expand Down Expand Up @@ -539,6 +537,7 @@ def setup(self, stage: str | None = None) -> None:
else:
self.val_dataset = None

@dependencies("tiledbsoma_ml")
def train_dataloader(self) -> DataLoader:
from tiledbsoma_ml import experiment_dataloader

Expand All @@ -547,6 +546,7 @@ def train_dataloader(self) -> DataLoader:
**self.dataloader_kwargs,
)

@dependencies("tiledbsoma_ml")
def val_dataloader(self) -> DataLoader:
from tiledbsoma_ml import experiment_dataloader

Expand Down