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

MessengerGuide incompatible with local param mode #3237

Open
ilia-kats opened this issue Jun 30, 2023 · 0 comments
Open

MessengerGuide incompatible with local param mode #3237

ilia-kats opened this issue Jun 30, 2023 · 0 comments

Comments

@ilia-kats
Copy link
Contributor

I have a custom messenger guide that subclasses AutoMessenger. I took inspiration from the existing messenger guides and use deep_setattr(self, name, PyroParam(...)) to create learnable parameters. I have now tried using my model/guide pair with local param mode (with pyro.settings.context(module_local_params=True):, and it throws a

NotImplementedError: Support for global pyro.param statements in PyroModules with local param mode enabled is not yet implemented.

The exception is coming from the model. Debugging it a bit, it looks like all the learnable parameters are saved in the _pyro_context of the model and not the guide. I believe that might be because:

  • guide enters its context, global param store updates its content to the guide's local parameters
  • guide calls model. Model enters its context, global param store updates its content to the model's local parameters
  • Sample statements in the model get intercepted by get_posterior, which creates the PyroParams
  • but the model's context is currently active, so the params are saved in the model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants