-
Notifications
You must be signed in to change notification settings - Fork 200
Add missing type imports + make compatible for Python 3.6 #275
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
- Seems to be required for python < 3.7
- Some are not imported but used
- Import all used common types in same way for each file
|
Example: you can go to the link: and it will run the tutorial in-browser. Just run: at the top. |
|
After a first quick look - thank you for the very granular commits and taking up the task of making I am surprised that the type imports were absent - how has this passed our CI tests in the last days? There's only one aspect of what I've seen that I would like to change: depending on a git version of nflows, but I guess @arturbekasov wouldn't mind to cut a |
|
I've cut a 0.12 release for |
|
Awesome, thanks @arturbekasov! That's great. And thanks @Meteore for the quick review! So it looks like the fact that these are passing might actually a long-running bug in Python: python/mypy#999 (essentially |
|
So everything is working in colab (https://colab.research.google.com/github/mackelab/sbi/blob/checkpointing/tutorial/00_getting_started.ipynb) with the pip version of nflows installed. pip gives a message about pyknos requiring nflows==0.11 still (I suppose its requirements will need to be updated too?), but it doesn't actually throw an error and the code all runs fine. Thanks again, |
|
@MilesCranmer this is really excellent and we are very grateful. I hope you are set for tomorrow's tutorial and we will be making a new release ASAP with Py3.6 support (we'll take care of the pip req. when we integrate your PR). Thanks again and please tell attendees to give us feedback; we're excited to welcome more cosmologists and learn more about specific needs of the field! |
|
Everything is good to go, thanks so much @Meteore! I will also be sure to ask for feedback from attendees. I think LFI is picking up steam in Cosmology which is great, and this package looks like a perfect framework for the community. Cheers, |
|
Thank you for the PR! We've released the changes as |
|
Awesome, thanks! |
|
@Meteore following up with feedback from the tutorial. Btw, I made an extended tutorial based off of 00_getting_started.ipynb if you'd like me to put it somewhere. Walks through a bit of the ideas behind ABC + LFI + normalizing flows. Also does a quick PyTorch demo (I'm trying to introduce more astronomers to it as a general sci computing package). They really liked the framework and how easy it was to use! Some issues we encountered:
Cheers! |
|
Hi Miles, thanks for all the feedback!
|
This is a work in progress PR.
I'm interested in hearing your comments. I performed some simple changes throughout the codebase to make it compatible for Python 3.6. The reason 3.6 would be of special interest is because the popular ML platform "Google Colaboratory" (used for freely demonstrating and sharing work requiring GPUs + a complex build environment) is exclusively on Python 3.6.
Changes include:
from __future__ import annotationsstatements.import sbi.utils as utilstofrom sbi import utils as utils, since the first is incompatible with 3.6.nflowsby changing nflows version from v0.11 to git commit bayesiains/nflows@84dc029 insetup.py(so it installs from git rather than from pypi). From a skim through the commit history, no major changes were added from v0.11 to this commit.