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

Avoid recompiling NumPyro models where possible #79

Open
null-a opened this issue Dec 3, 2019 · 2 comments
Open

Avoid recompiling NumPyro models where possible #79

null-a opened this issue Dec 3, 2019 · 2 comments
Milestone

Comments

@null-a
Copy link
Collaborator

null-a commented Dec 3, 2019

If we do something like:

model = define_model(...)
fit1 = model.run_algo('nuts', ...)
fit2 = model.run_algo('nuts', ...)

... then each call to run_algo will invoke NumPyro's model compilation. It ought to be possible to avoid this (in cases where the data shape doesn't change between calls) by caching the MCMC instance and reusing it on subsequent calls.

@null-a null-a added this to the v0.0.1 milestone Dec 3, 2019
@null-a null-a changed the title Avoid recompiling numpyro model's where possible Avoid recompiling numpyro models where possible Dec 3, 2019
@null-a null-a changed the title Avoid recompiling numpyro models where possible Avoid recompiling NumPyro models where possible Dec 3, 2019
@neerajprad
Copy link
Member

(in cases where the data shape doesn't change between calls)

Even if the data shape changes, but we can commit to a certain max size, it might be possible to use a masked distribution to enable this. We haven't needed a masked distribution in numpyro yet, but this may be a good use case. cc. @fehiepsi

@null-a
Copy link
Collaborator Author

null-a commented Dec 6, 2019

The feature is available in NumPyro >=0.2.2.

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

No branches or pull requests

2 participants