-
Notifications
You must be signed in to change notification settings - Fork 381
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
Open
ori-kron-wis
wants to merge
96
commits into
main
Choose a base branch
from
ori-2907-custom-dataloader-registry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,112
−216
Open
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
7088e4b
copying CZI custom dataloader into our repo
ori-kron-wis cc72b05
added some fixes to the custom dataloader stuff
ori-kron-wis 46048e3
Some suggestions
canergen 14f343d
Changes to datamodule pipeline
canergen 17282cd
Fixed attr_dict
canergen a4143f5
added some fixes based on custom data loader test
ori-kron-wis 69abc47
Changes to dataloader
canergen dc21a3d
copying CZI custom dataloader into our repo
ori-kron-wis a1098b3
added some fixes to the custom dataloader stuff
ori-kron-wis b07216b
Some suggestions
canergen a578af1
Changes to datamodule pipeline
canergen 42434ec
Fixed attr_dict
canergen 3d0c890
added some fixes based on custom data loader test
ori-kron-wis eff5b1e
Changes to dataloader
canergen cbdc26e
Merge remote-tracking branch 'origin/ori-2907-custom-dataloader-regis…
ori-kron-wis 18d65a6
add changes to tests and some merging with main following custom data…
ori-kron-wis 4fe3ee1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 1110966
just put the cutom dataloder2 test under remarks so hook tests will r…
ori-kron-wis 7972bdc
fixes
ori-kron-wis 2d86c43
additional external models fixes once there is a registry
ori-kron-wis 3c44d86
fixed a few failed tests
ori-kron-wis c0889d8
fix archesmixin init and added new custom dataloader test and github …
ori-kron-wis 8fe043c
fix again for from __future__ import annotations
ori-kron-wis d8cf0f6
fix for run custom dataloader in github action
ori-kron-wis c41e8b2
rollback
ori-kron-wis 6ec5d4d
added label to the new githubaction for custom dataloader
ori-kron-wis 6bce317
fix for github action for custom dataloaders
ori-kron-wis 1f4ae9d
another fix to custom dataloder test and github action
ori-kron-wis de1f30b
another fix to custom dataloder test and github action
ori-kron-wis 49fa01e
another fix to custom dataloder test and github action
ori-kron-wis e33a935
another fix to custom dataloder test and github action
ori-kron-wis 48627d9
another fix to custom dataloder test and github action
ori-kron-wis 609094d
another fix to custom dataloder test and github action
ori-kron-wis 8cf3517
another fix to custom dataloder test and github action
ori-kron-wis ba5a028
another fix to custom dataloder test and github action
ori-kron-wis a7dc3fe
another fix to custom dataloder test and github action
ori-kron-wis f3ff0f8
another fix to custom dataloder test and github action
ori-kron-wis 083c76e
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 70bba69
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 8c75662
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis b6eb2f1
Returned REGISTRY_KEYS for import, after was drop in recent merges
ori-kron-wis 2979ea2
It is ok to drop it after scarches categorial covariates fix
ori-kron-wis 67e9b34
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 11fe33a
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 4a648ff
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e3831cb
moved to type checking blocks beucase of ruff updates
ori-kron-wis e1837bd
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis bf4d3bf
Merge remote-tracking branch 'origin/main' into ori-2907-custom-datal…
ori-kron-wis 2cc8ff9
updated for CZI custom dataloader test and backend
ori-kron-wis e62dc3a
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 41fd877
added cellxgene-census folder as well for debug (will not be merged)
ori-kron-wis 10ada9c
added cellxgene-census packge to run test
ori-kron-wis dd3649c
added torchdata packge to run test
ori-kron-wis c6acb5a
fixed the test workwflow
ori-kron-wis b35c6eb
adding the lamindb as well
ori-kron-wis 1801604
fix the c.dataloders test
ori-kron-wis ed77a65
fix the c.dataloders test
ori-kron-wis fc831d5
fix the c.dataloders test
ori-kron-wis 7400621
fix the c.dataloders test
ori-kron-wis 47376ca
fix the c.dataloders test
ori-kron-wis f94f7fa
removed redundat functions in code base
ori-kron-wis 962f043
Added scanvi support, including CZI datamodule fix for it
ori-kron-wis 5c21d71
Merge remote-tracking branch 'origin/main' into ori-2907-custom-datal…
ori-kron-wis a8aeffe
updates from main
ori-kron-wis 1283616
more updates from main
ori-kron-wis 624ee72
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 6d4f368
Merge remote-tracking branch 'origin/ori-2907-custom-dataloader-regis…
ori-kron-wis 8ab01a4
updated related to tests
ori-kron-wis 31e1d44
updated related to tests
ori-kron-wis 93666fa
Running DataLoader MappedCollection
canergen 1d1d6d3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7695a8a
Fixed LaminDB dataloader
canergen e4d732a
Merge branch 'ori-2907-custom-dataloader-registry' of https://github.…
canergen a651442
LaminDB dataloader test.
canergen 9767b8c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 719e740
Merge branch 'main' into ori-2907-custom-dataloader-registry
ori-kron-wis 1a4c796
Merge remote-tracking branch 'origin/main' into ori-2907-custom-datal…
ori-kron-wis 5666558
Changes for MappedCollection.
canergen c740dd2
Merge branch 'ori-2907-custom-dataloader-registry' of https://github.…
canergen 61f2e27
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 874935b
Add other notebook for testing new dataloader
canergen f2c63bd
Merge branch 'ori-2907-custom-dataloader-registry' of https://github.…
canergen 35d45c8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 38c670f
Merge remote-tracking branch 'origin/main' into ori-2907-custom-datal…
ori-kron-wis c93fc97
updates to test script
ori-kron-wis 5045fc3
remove old test nb
ori-kron-wis 55775f9
update test
ori-kron-wis 7ccdf8d
update test
ori-kron-wis f88dc50
updated czi cdl
ori-kron-wis 1f3ea11
updated czi cdl
ori-kron-wis d0ec46f
Merge remote-tracking branch 'origin/main' into ori-2907-custom-datal…
ori-kron-wis e304922
merge with main + updates
ori-kron-wis 5ccd1ed
more updates
ori-kron-wis 96a09d8
more updates
ori-kron-wis 601d86f
more updates
ori-kron-wis 2485bb6
pyproject update
ori-kron-wis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added some fixes to the custom dataloader stuff
- Loading branch information
commit cc72b05f27f75f349b5946aeaca5e30a10bdcb21
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
|
||
import numpy as np | ||
import scanpy as sc | ||
|
||
import scvi | ||
from scvi.data import _constants, synthetic_iid | ||
from scvi.model import SCVI | ||
|
||
# We will now create the SCVI model object: | ||
# Its parameters: | ||
n_layers = 1 | ||
n_latent = 10 | ||
batch_size = 1024 | ||
train_size = 0.9 | ||
max_epochs = 1 | ||
|
||
|
||
# COMAPRE TO THE ORIGINAL METHOD!!! - use the same data!!! | ||
# We first create a registry using the orignal way of anndata in order to compare and add | ||
# what is missing | ||
adata = synthetic_iid() | ||
adata.obs["size_factor"] = np.random.randint(1, 5, size=(adata.shape[0],)) | ||
SCVI.setup_anndata( | ||
adata, | ||
batch_key="batch", | ||
labels_key="labels", | ||
size_factor_key="size_factor", | ||
) | ||
# | ||
model_orig = SCVI(adata, n_latent=n_latent) | ||
model_orig.train(1, check_val_every_n_epoch=1, train_size=0.5) | ||
|
||
# Saving the model | ||
save_dir = "/Users/orikr/runs/290724/" # tempfile.TemporaryDirectory() | ||
model_dir = os.path.join(save_dir, "scvi_orig_model") | ||
model_orig.save(model_dir, overwrite=True) | ||
|
||
# Loading the model (just as a compariosn) | ||
model_orig_loaded = scvi.model.SCVI.load(model_dir, adata=adata) | ||
|
||
# Obtaining model outputs | ||
SCVI_LATENT_KEY = "X_scVI" | ||
latent = model_orig.get_latent_representation() | ||
adata.obsm[SCVI_LATENT_KEY] = latent | ||
# latent.shape | ||
|
||
# You can see all necessary entries and the structure at | ||
adata_manager = model_orig.adata_manager | ||
model_orig.view_anndata_setup(hide_state_registries=True) | ||
# adata_manager.get_state_registry(SCVI.REGISTRY_KEYS.X_KEY).to_dict() | ||
adata_manager.registry[_constants._FIELD_REGISTRIES_KEY] | ||
|
||
# Plot UMAP and save the figure for later check | ||
sc.pp.neighbors(adata, use_rep="scvi", key_added="scvi") | ||
sc.tl.umap(adata, neighbors_key="scvi") | ||
sc.pl.umap(adata, color="dataset_id", title="SCVI") | ||
|
||
# Now return and add all the registry stuff that we will need | ||
|
||
# Now add the missing stuff from the current CZI implemenation in order for us to have the exact | ||
# same steps like the original way (except than setup_anndata) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
remove module_init_on_train. This is deprecated code with the new dataloader implementation.