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

Fix bound partial for python 3.10 #3101

Merged
merged 6 commits into from
Jun 4, 2022
Merged

Fix bound partial for python 3.10 #3101

merged 6 commits into from
Jun 4, 2022

Conversation

fehiepsi
Copy link
Member

@fehiepsi fehiepsi commented Jun 2, 2022

Fixes #3095 and resolves #3018.

In Python <= 3.9, _bound_partial(_bound_partial(f)).func != f but for some reasons, they are the same in Python 3.10. This PR tries to address such issue by registering func as a slot of _bound_partial.

@fehiepsi
Copy link
Member Author

fehiepsi commented Jun 3, 2022

For some reason, the change is failing for infer_discrete with temperature=1 and funsor backend. I have been debugging this but still haven't figured it out. Edit: In ReentrantMessenger, instead of returning _bound_partial(fn), we return wraps(fn)(_bound_partial(fn)) hence _bound_partial(_bound_partial(fn)).func is fn, which faces the same issue as the one we wanted to address in this PR.

Copy link
Member

@fritzo fritzo left a comment

Choose a reason for hiding this comment

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

LGTM Valiant effort solving this @fehiepsi!

One thing to keep in mind is that classes with __slots__ might not be pickleable (they weren't in Python 2, and I'm not sure if that's been fixed in Python 3). Let's keep an eye out for new pickling errors this might introduce.

@fritzo fritzo merged commit 9022252 into pyro-ppl:dev Jun 4, 2022
@Balandat
Copy link
Contributor

Balandat commented Sep 6, 2022

Are there plans to put out a new release with these changes anytime soon? Looks like the latest release 1.8.1. still doesn't support python 3.10.

@fritzo
Copy link
Member

fritzo commented Sep 6, 2022

Hi @Balandat sure we can push out a release this week. Thanks for the ping

@fritzo
Copy link
Member

fritzo commented Sep 6, 2022

@Balandat just released Pyro 1.8.2.

@Balandat
Copy link
Contributor

Balandat commented Sep 7, 2022

Woohoo, thanks! Great customer service! Where do I leave my yelp review?

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