-
Notifications
You must be signed in to change notification settings - Fork 366
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
Custom dataloader registry support #2932
base: main
Are you sure you want to change the base?
Conversation
…try' into ori-2907-custom-dataloader-registry
…module / registry big change
for more information, see https://pre-commit.ci
…un, we will later adjust this file
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2932 +/- ##
==========================================
- Coverage 90.14% 82.50% -7.65%
==========================================
Files 181 181
Lines 15644 15548 -96
==========================================
- Hits 14103 12828 -1275
- Misses 1541 2720 +1179
|
and fix the test for custom dataloaders
adata.obs["batch"] = adata.obs[batch_keys].agg("".join, axis=1).astype("category") | ||
|
||
scvi.model.SCVI.prepare_query_anndata(adata, save_path) | ||
scvi.model.SCVI.load_query_data(registry=datamodule.registry, reference_model=save_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have more tests that actually fail - using different genes without prepare_query_anndata and different batch categories. Assert that it fails.
|
||
scvi.model.SCVI.prepare_query_anndata(adata, model_census2) | ||
|
||
scvi.model.SCVI.setup_anndata(adata, batch_key="batch") # needed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking that an AnnData model can be trained using datamodule. Do we really want it?
|
||
user_attributes_model_census3 = model_census3._get_user_attributes() | ||
pprint(user_attributes_model_census3) | ||
_ = model_census3.get_elbo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses AnnData for inference?
scvi.model.SCVI.prepare_query_anndata(adata, model_census3) | ||
scvi.model.SCVI.load_query_data(adata, model_census3) | ||
|
||
datamodule_inference = CensusSCVIDataModule( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check here that using different genes and different batches fails. You can take much fewer cells here, like 1000.
# Create a dataloder of a CZI module | ||
datapipe = datamodule_inference.datapipe | ||
dataloader = experiment_dataloader(datapipe, num_workers=0, persistent_workers=False) | ||
mapped_dataloader = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this?
|
||
model = SCVI(adata, n_latent=n_latent) | ||
model.train(max_epochs=1) | ||
dataloader = model._make_data_loader(adata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does model._make_data_loader exist for all models? We should then add the test to the other models as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the dataloader sufficient to also setup the model and does setup_datamodule work for it?
…try' into ori-2907-custom-dataloader-registry
for more information, see https://pre-commit.ci
…com/scverse/scvi-tools into ori-2907-custom-dataloader-registry
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
for more information, see https://pre-commit.ci
…oader-registry # Conflicts: # docs/tutorials/notebooks
…com/scverse/scvi-tools into ori-2907-custom-dataloader-registry
for more information, see https://pre-commit.ci
…com/scverse/scvi-tools into ori-2907-custom-dataloader-registry
for more information, see https://pre-commit.ci
No description provided.