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

interoperability with pyro to simplify implementing complex hierarchical priors? #862

Closed
vitkl opened this issue Nov 23, 2020 · 5 comments · Fixed by #895
Closed

interoperability with pyro to simplify implementing complex hierarchical priors? #862

vitkl opened this issue Nov 23, 2020 · 5 comments · Fixed by #895
Labels

Comments

@vitkl
Copy link
Contributor

vitkl commented Nov 23, 2020

Hi scVI team!

I am wondering if you are planning any interoperability with pyro to simplify implementing complex hierarchical priors? Maybe you have other ideas of simplifying that? I would like to try to adding Variational Autoencoding posteriors to cell2location (https://github.com/BayraktarLab/cell2location, https://www.biorxiv.org/content/10.1101/2020.11.15.378125v1.full) - would be cool if this is possible by integrating with scVI.

Thanks

Vitalii

@vitkl vitkl added the question label Nov 23, 2020
@adamgayoso
Copy link
Member

Hi Vitalii,

We don't currently support pyro -- we could after we finish the current model changes (move to pytorch lightning for training and it seems pyro can work with pytorch lightning).

Since you're considering amortized VI, do you have a sketch already of the model and posteriors? I see your model has many latent variables, but if you're using a mean field approximation, manually coding the ELBO maybe could not be so challenging?

I'm happy to continue this discussion, but it would be very helpful for us to continue at https://discourse.scvi-tools.org/ -- which we are hoping to use for topics like this.

@vitkl
Copy link
Contributor Author

vitkl commented Nov 23, 2020

Hi Adam

Support for pyro would be quite amazing. Sound like it is better to wait until you finish the changes. I will re-initiate the discussion on the forum.

With this many parameters, my concern is that it would be necessary to reinvent something similar to pyro to automatically collect KL contributions from parameters. I struggle a bit with wrapping my head around the minimal number of steps needed to add this to scVI (I tried inferring this from the AutoZiVAE model but it has extra bits like reparametrisation of Beta distr. which make it harder to understand what is minimally needed).

@adamgayoso
Copy link
Member

@vitkl now that we have redone our backend, we are going to explore interoperability with Pyro. It actually seems like it can be easily done. Do you have a version of your model in pyro now that I could take a look at?

If this all works out and you're interested, you'd be able to have a model potentially in scvi.external, or you can use our new template repository (https://github.com/YosefLab/scvi-tools-skeleton)

@vitkl
Copy link
Contributor Author

vitkl commented Jan 28, 2021 via email

@adamgayoso
Copy link
Member

Thanks for sharing. I'm hoping the interface will be generic enough such that your code would just basically have to be copy pasted into different places -- structured in such a way that it will interface well with our higher-level models and black box train methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants