From e1433ff8d00b04aafd49b4caf5ec57e8c8e9dcb3 Mon Sep 17 00:00:00 2001 From: Du Phan Date: Mon, 27 Jul 2020 12:00:09 -0500 Subject: [PATCH] Bump to version 0.3.0 (#697) --- README.md | 4 ++-- examples/annotation.py | 2 +- examples/baseball.py | 2 +- examples/bnn.py | 2 +- examples/covtype.py | 2 +- examples/funnel.py | 2 +- examples/gp.py | 2 +- examples/hmm.py | 2 +- examples/minipyro.py | 2 +- examples/neutra.py | 2 +- examples/ode.py | 2 +- examples/proportion_test.py | 2 +- examples/sparse_regression.py | 2 +- examples/stochastic_volatility.py | 2 +- examples/ucbadmit.py | 2 +- examples/vae.py | 2 +- notebooks/source/bayesian_imputation.ipynb | 2 +- notebooks/source/bayesian_regression.ipynb | 2 +- notebooks/source/conf.py | 8 +++++--- notebooks/source/logistic_regression.ipynb | 2 +- notebooks/source/time_series_forecasting.ipynb | 2 +- numpyro/contrib/funsor/__init__.py | 5 ++++- numpyro/version.py | 2 +- setup.py | 6 +++--- 24 files changed, 34 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index a202c4ec8..ed1dd80a5 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ Pyro users will note that the API for model specification and inference is large ## Installation -> **Limited Windows Support:** Note that NumPyro is untested on Windows, and will require building jaxlib from source. See this [JAX issue](https://github.com/google/jax/issues/438) for more details. +> **Limited Windows Support:** Note that NumPyro is untested on Windows, and might require building jaxlib from source. See this [JAX issue](https://github.com/google/jax/issues/438) for more details. Alternatively, you can install [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/) and use NumPyro on it as on a Linux system. See also [CUDA on Windows Subsystem for Linux](https://developer.nvidia.com/cuda/wsl) if you want to use GPUs on Windows. To install NumPyro with a CPU version of JAX, you can use pip: @@ -199,7 +199,7 @@ You can also install NumPyro from source: ``` git clone https://github.com/pyro-ppl/numpyro.git # install jax/jaxlib first for CUDA support -pip install -e .[dev] +pip install -e .[dev] # contains additional dependencies for NumPyro development ``` ## Frequently Asked Questions diff --git a/examples/annotation.py b/examples/annotation.py index 008f6d69e..beddf2582 100644 --- a/examples/annotation.py +++ b/examples/annotation.py @@ -264,7 +264,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith("0.2.4") + assert numpyro.__version__.startswith("0.3.0") parser = argparse.ArgumentParser(description="Bayesian Models of Annotation") parser.add_argument("-n", "--num-samples", nargs="?", default=1000, type=int) parser.add_argument("--num-warmup", nargs="?", default=1000, type=int) diff --git a/examples/baseball.py b/examples/baseball.py index ded162a92..5c20384cf 100644 --- a/examples/baseball.py +++ b/examples/baseball.py @@ -196,7 +196,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Baseball batting average using HMC") parser.add_argument("-n", "--num-samples", nargs="?", default=3000, type=int) parser.add_argument("--num-warmup", nargs='?', default=1500, type=int) diff --git a/examples/bnn.py b/examples/bnn.py index bf8015753..78f27e64f 100644 --- a/examples/bnn.py +++ b/examples/bnn.py @@ -136,7 +136,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Bayesian neural network example") parser.add_argument("-n", "--num-samples", nargs="?", default=2000, type=int) parser.add_argument("--num-warmup", nargs='?', default=1000, type=int) diff --git a/examples/covtype.py b/examples/covtype.py index 6c5f53354..992be59e1 100644 --- a/examples/covtype.py +++ b/examples/covtype.py @@ -58,7 +58,7 @@ def main(args): if __name__ == '__main__': - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="parse args") parser.add_argument('-n', '--num-samples', default=100, type=int, help='number of samples') parser.add_argument('--num-steps', default=10, type=int, help='number of steps (for "HMC")') diff --git a/examples/funnel.py b/examples/funnel.py index 39b92b5eb..22afdfc84 100644 --- a/examples/funnel.py +++ b/examples/funnel.py @@ -90,7 +90,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Non-centered reparameterization example") parser.add_argument("-n", "--num-samples", nargs="?", default=1000, type=int) parser.add_argument("--num-warmup", nargs='?', default=1000, type=int) diff --git a/examples/gp.py b/examples/gp.py index 096406d3e..cd286f32a 100644 --- a/examples/gp.py +++ b/examples/gp.py @@ -129,7 +129,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Gaussian Process example") parser.add_argument("-n", "--num-samples", nargs="?", default=1000, type=int) parser.add_argument("--num-warmup", nargs='?', default=1000, type=int) diff --git a/examples/hmm.py b/examples/hmm.py index 40f0bb4c5..260624c72 100644 --- a/examples/hmm.py +++ b/examples/hmm.py @@ -189,7 +189,7 @@ def main(args): if __name__ == '__main__': - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description='Semi-supervised Hidden Markov Model') parser.add_argument('--num-categories', default=3, type=int) parser.add_argument('--num-words', default=10, type=int) diff --git a/examples/minipyro.py b/examples/minipyro.py index 476388b80..45a4b00e5 100644 --- a/examples/minipyro.py +++ b/examples/minipyro.py @@ -58,7 +58,7 @@ def body_fn(i, val): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Mini Pyro demo") parser.add_argument("-f", "--full-pyro", action="store_true", default=False) parser.add_argument("-n", "--num-steps", default=1001, type=int) diff --git a/examples/neutra.py b/examples/neutra.py index d1bfb8831..006a9b6ea 100644 --- a/examples/neutra.py +++ b/examples/neutra.py @@ -145,7 +145,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="NeuTra HMC") parser.add_argument('-n', '--num-samples', nargs='?', default=4000, type=int) parser.add_argument('--num-warmup', nargs='?', default=1000, type=int) diff --git a/examples/ode.py b/examples/ode.py index af087734c..2c34b8593 100644 --- a/examples/ode.py +++ b/examples/ode.py @@ -98,7 +98,7 @@ def main(args): if __name__ == '__main__': - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description='Predator-Prey Model') parser.add_argument('-n', '--num-samples', nargs='?', default=1000, type=int) parser.add_argument('--num-warmup', nargs='?', default=1000, type=int) diff --git a/examples/proportion_test.py b/examples/proportion_test.py index 650c0edf2..dc5f92684 100644 --- a/examples/proportion_test.py +++ b/examples/proportion_test.py @@ -125,7 +125,7 @@ def main(args): if __name__ == '__main__': - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description='Testing whether ') parser.add_argument('-n', '--num-samples', nargs='?', default=500, type=int) parser.add_argument('--num-warmup', nargs='?', default=1500, type=int) diff --git a/examples/sparse_regression.py b/examples/sparse_regression.py index dd8a03925..53990ed59 100644 --- a/examples/sparse_regression.py +++ b/examples/sparse_regression.py @@ -320,7 +320,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Gaussian Process example") parser.add_argument("-n", "--num-samples", nargs="?", default=1000, type=int) parser.add_argument("--num-warmup", nargs='?', default=500, type=int) diff --git a/examples/stochastic_volatility.py b/examples/stochastic_volatility.py index 6bb388cda..9695e1dab 100644 --- a/examples/stochastic_volatility.py +++ b/examples/stochastic_volatility.py @@ -110,7 +110,7 @@ def main(args): if __name__ == "__main__": - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="Stochastic Volatility Model") parser.add_argument('-n', '--num-samples', nargs='?', default=600, type=int) parser.add_argument('--num-warmup', nargs='?', default=600, type=int) diff --git a/examples/ucbadmit.py b/examples/ucbadmit.py index 4676ef940..26e585022 100644 --- a/examples/ucbadmit.py +++ b/examples/ucbadmit.py @@ -128,7 +128,7 @@ def main(args): if __name__ == '__main__': - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description='UCBadmit gender discrimination using HMC') parser.add_argument('-n', '--num-samples', nargs='?', default=2000, type=int) parser.add_argument('--num-warmup', nargs='?', default=500, type=int) diff --git a/examples/vae.py b/examples/vae.py index f83a89f80..08cc3fa18 100644 --- a/examples/vae.py +++ b/examples/vae.py @@ -131,7 +131,7 @@ def reconstruct_img(epoch, rng_key): if __name__ == '__main__': - assert numpyro.__version__.startswith('0.2.4') + assert numpyro.__version__.startswith('0.3.0') parser = argparse.ArgumentParser(description="parse args") parser.add_argument('-n', '--num-epochs', default=15, type=int, help='number of training epochs') parser.add_argument('-lr', '--learning-rate', default=1.0e-3, type=float, help='learning rate') diff --git a/notebooks/source/bayesian_imputation.ipynb b/notebooks/source/bayesian_imputation.ipynb index 5d1083c45..29b5d0305 100644 --- a/notebooks/source/bayesian_imputation.ipynb +++ b/notebooks/source/bayesian_imputation.ipynb @@ -44,7 +44,7 @@ "if \"NUMPYRO_SPHINXBUILD\" in os.environ:\n", " set_matplotlib_formats(\"svg\")\n", "\n", - "assert numpyro.__version__.startswith(\"0.2.4\")" + "assert numpyro.__version__.startswith(\"0.3.0\")" ] }, { diff --git a/notebooks/source/bayesian_regression.ipynb b/notebooks/source/bayesian_regression.ipynb index b3d2ce985..0b8722d3d 100644 --- a/notebooks/source/bayesian_regression.ipynb +++ b/notebooks/source/bayesian_regression.ipynb @@ -66,7 +66,7 @@ "if \"NUMPYRO_SPHINXBUILD\" in os.environ:\n", " set_matplotlib_formats('svg')\n", "\n", - "assert numpyro.__version__.startswith('0.2.4')" + "assert numpyro.__version__.startswith('0.3.0')" ] }, { diff --git a/notebooks/source/conf.py b/notebooks/source/conf.py index a34997a56..b9fae84f9 100644 --- a/notebooks/source/conf.py +++ b/notebooks/source/conf.py @@ -99,7 +99,8 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['.ipynb_checkpoints', 'logistic_regression.ipynb'] +exclude_patterns = ['.ipynb_checkpoints', 'logistic_regression.ipynb', + 'examples/*ipynb', 'examples/*py'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' @@ -178,8 +179,9 @@ def __call__(self, block, block_vars, gallery_conf): sphinx_gallery_conf = { 'examples_dirs': ['../../examples'], - 'gallery_dirs': 'examples', - 'filename_pattern': '.py', + 'gallery_dirs': ['examples'], + # slow examples can be added to here to avoid execution + 'filename_pattern': r'(?!hmm_enum)\b\w+.py\b', 'ignore_pattern': '(minipyro|covtype|__init__)', 'within_subsection_order': GalleryFileNameSortKey, 'image_scrapers': ('matplotlib', PNGScraper()), diff --git a/notebooks/source/logistic_regression.ipynb b/notebooks/source/logistic_regression.ipynb index 43986b983..4a4acde6b 100644 --- a/notebooks/source/logistic_regression.ipynb +++ b/notebooks/source/logistic_regression.ipynb @@ -31,7 +31,7 @@ "import numpyro.distributions as dist\n", "from numpyro.examples.datasets import COVTYPE, load_dataset\n", "from numpyro.infer import HMC, MCMC, NUTS\n", - "assert numpyro.__version__.startswith('0.2.4')\n", + "assert numpyro.__version__.startswith('0.3.0')\n", "\n", "# NB: replace gpu by cpu to run this notebook in cpu\n", "numpyro.set_platform(\"gpu\")" diff --git a/notebooks/source/time_series_forecasting.ipynb b/notebooks/source/time_series_forecasting.ipynb index 3d761be5f..fdcf14ac2 100644 --- a/notebooks/source/time_series_forecasting.ipynb +++ b/notebooks/source/time_series_forecasting.ipynb @@ -39,7 +39,7 @@ " set_matplotlib_formats(\"svg\")\n", "\n", "numpyro.set_host_device_count(4)\n", - "assert numpyro.__version__.startswith(\"0.2.4\")" + "assert numpyro.__version__.startswith(\"0.3.0\")" ] }, { diff --git a/numpyro/contrib/funsor/__init__.py b/numpyro/contrib/funsor/__init__.py index 0cab5dd5d..647017717 100644 --- a/numpyro/contrib/funsor/__init__.py +++ b/numpyro/contrib/funsor/__init__.py @@ -4,7 +4,10 @@ try: import funsor except ImportError: - raise ImportError("`funsor` package is missing. You can install it with `pip install funsor`.") + raise ImportError("Looking like you want to do inference for models with " + "discrete latent variables. This is an experimental feature. " + "You need to install `funsor` to be able to use this feature. " + "It can be installed with `pip install funsor`.") from numpyro.contrib.funsor.enum_messenger import enum, infer_config, markov, plate, to_data, to_funsor, trace from numpyro.contrib.funsor.infer_util import config_enumerate, log_density, plate_to_enum_plate diff --git a/numpyro/version.py b/numpyro/version.py index 4a0b039a3..92cc13b1e 100644 --- a/numpyro/version.py +++ b/numpyro/version.py @@ -1,4 +1,4 @@ # Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 -__version__ = '0.2.4' +__version__ = '0.3.0' diff --git a/setup.py b/setup.py index 1db6ece57..9bc977cc9 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,9 @@ author_email='npradhan@uber.com', install_requires=[ # TODO: pin to a specific version for the release (until JAX's API becomes stable) - 'jax>=0.1.70', + 'jax==0.1.73', # check min version here: https://github.com/google/jax/blob/master/jax/lib/__init__.py#L20 - 'jaxlib>=0.1.47', + 'jaxlib==0.1.51', 'tqdm', ], extras_require={ @@ -47,7 +47,7 @@ 'pyro-api>=0.1.1' ], 'dev': [ - 'funsor @ git+https://github.com/pyro-ppl/funsor.git@b4db46acc5ab615abd2e1297f65ff5e70e961876#egg=funsor', + 'funsor', 'ipython', 'isort', ],