-
-
Notifications
You must be signed in to change notification settings - Fork 995
Render deterministic functions #3259
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
Conversation
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.
Hi @r3v1, thanks for taking on this task! Could you describe your approach a bit in the PR description? 🙏
It's been almost a year since I looked into this, but I recall one issue was that Pyro's visualization reuses inference machinery for tracking dependency, and the goals of these two uses are a bit at odds: in inference one wants to ignore deterministic dependencies and simply track stochastic latent variables because only those stochastic latent variables can be freely varied during inference. By contrast in visualization one often wants to inspect the model, including in many cases deterministic dependencies or even compute graphs.
Now again it's been a while but I think where I left off on this task, it seemed challenging to separate these two concerns, like we might need to fork some of the provenance tracking and maybe add some conditional flags so one could optionally trace deterministic nodes (for visualization) or optionally elide them (for inference). I'm not sure how you PR might address these issues, but I think it's worth examining before making changes that affect inference. 🙂
EDIT could you also please describe your merge intention? I see you're merging into my old branch, but maybe you should just create a new branch incorporating those old changes? And thanks again for continuing this line of work!
Of course @fritzo, I could explain the process I have gone through. First, I started by studying the unit tests and seeing what the When calling Of course, the primitive Finally, I apply some corrections to the core of That`s it. Hope it works, or at least, it do the job on my project 🤓 About the merge intention, I just take the render-deterministic branch to continue the work done. It cannot be merged into the |
Hi, any advances on this? |
@r3v1 could you revert your changes to the body of You can just use a helper function to check within a def site_is_deterministic(msg: dict) -> bool:
return msg["type"] == "sample" and msg["infer"].get("_deterministic", False)
...
class ...:
...
def _pyro_sample(self, msg):
if site_is_deterministic(msg):
# new logic for handling deterministic sites here
...
return
# old logic for handling sample sites here
... |
@r3v1 I also just changed the base branch to |
Ok, changes made in pull request #3266 to dev branch, so this branch may be closed |
Addresses #3134.