Skip to content
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

Implement Tangram #1743

Merged
merged 46 commits into from
Oct 20, 2022
Merged

Implement Tangram #1743

merged 46 commits into from
Oct 20, 2022

Conversation

adamgayoso
Copy link
Member

@adamgayoso adamgayoso commented Oct 16, 2022

Fixes #1738

Example on this tutorials PR.

Also fixes an issue with the to() to device method after removing JaxModuleWrapper

@codecov
Copy link

codecov bot commented Oct 16, 2022

Codecov Report

Base: 90.84% // Head: 90.85% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (9b41154) compared to base (2c22bda).
Patch coverage: 89.54% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #1743    +/-   ##
========================================
  Coverage   90.84%   90.85%            
========================================
  Files         115      118     +3     
  Lines        9758     9969   +211     
========================================
+ Hits         8865     9057   +192     
- Misses        893      912    +19     
Impacted Files Coverage Δ
scvi/data/_datasets.py 96.07% <ø> (ø)
scvi/module/base/_base_module.py 93.36% <0.00%> (-0.39%) ⬇️
scvi/data/_built_in_data/_synthetic.py 95.83% <66.66%> (-4.17%) ⬇️
scvi/external/tangram/_model.py 90.00% <90.00%> (ø)
scvi/external/tangram/_module.py 93.10% <93.10%> (ø)
scvi/data/__init__.py 100.00% <100.00%> (ø)
scvi/data/_manager.py 98.25% <100.00%> (+0.06%) ⬆️
scvi/external/__init__.py 100.00% <100.00%> (ø)
scvi/external/tangram/__init__.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adamgayoso adamgayoso added this to the 0.19.0 milestone Oct 16, 2022
@adamgayoso adamgayoso marked this pull request as ready for review October 16, 2022 19:13
@adamgayoso adamgayoso changed the title Implement Tangram [DO NOT MERGE] Implement Tangram Oct 18, 2022
@adamgayoso adamgayoso changed the title [DO NOT MERGE] Implement Tangram Implement Tangram Oct 19, 2022
Comment on lines +169 to +176
tensor_dict = self._get_tensor_dict(device=device)
training_plan = JaxTrainingPlan(self.module, **plan_kwargs)
module_init = self.module.init(self.module.rngs, tensor_dict)
state, params = module_init.pop("params")
training_plan.set_train_state(params, state)
train_step_fn = JaxTrainingPlan.jit_training_step
pbar = track(range(max_epochs), style="tqdm", description="Training")
history = pd.DataFrame(index=np.arange(max_epochs), columns=["loss"])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @justjhong it's actually pretty flexible

you can use the training plan just as a shell

Comment on lines +29 to +45
@dataclass
class AnnDataManagerValidationCheck:
"""
Validation checks for AnnorMudata scvi-tools compat.

Parameters
----------
check_if_view
If True, checks if AnnData is a view.
check_fully_paired_mudata
If True, checks if MuData is fully paired across mods.
"""

check_if_view: bool = True
check_fully_paired_mudata: bool = True


Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justjhong what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine, the user will never interact with this right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

scvi/data/_manager.py Outdated Show resolved Hide resolved
@adamgayoso adamgayoso merged commit 5478135 into main Oct 20, 2022
@adamgayoso adamgayoso deleted the tangram branch October 20, 2022 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Tangram
3 participants